Giter Site home page Giter Site logo

propose's People

Contributors

iancovert avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

propose's Issues

Torch dependency error

Hello again,

I'm now trying to use your pipeline with a 'cuda' device. However, I get the following error:

using HurdleLoss, starting with lam = 0.01
Training epochs:   0%|                                                                                                                                                                                                                                | 0/500 [00:00<?, ?it/s]T
raceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\runpy.py", line 289, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "X:\RiGu\run_propose.py", line 59, in <module>
    candidates, model = selector.eliminate(target=500, mbsize=128, max_nepochs=500)
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\site-packages\propose\selection.py", line 179, in eliminate
    model.fit(self.train,
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\site-packages\propose\models.py", line 494, in fit
    for x, y in train_loader:
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\site-packages\torch\utils\data\dataloader.py", line 444, in __iter__
    return self._get_iterator()
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\site-packages\torch\utils\data\dataloader.py", line 390, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\site-packages\torch\utils\data\dataloader.py", line 1077, in __init__
    w.start()
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\context.py", line 336, in _Popen
    return Popen(process_obj)
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\resolve\.conda\envs\celltype_ann\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError:        
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

I installed torch and propose like this:

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch     

cd ~/Programs ; git clone https://github.com/iancovert/propose/ ; cd propose ; pip install . 

Do you think this is a bug or wrongly installed dependencies? (which torch/pytorch versions do you recommend?)

EDIT: The error also happens with a 'cpu' device, as well as when all dependencies are installed with pip

Kind regards,
Ricardo

KeyError ; Tutorial improvement?

Hi,

You're tool looks really interesting but imitating the tutorial is not working for me

This is my binary:
image

And my logcpm):
image

I set up the ExpressionDataset objects (with a simple train_test split) and try running PROPOSE:

# Set up datasets
train_dataset = ExpressionDataset(binary[:3000], logcpm[:3000])
val_dataset   = ExpressionDataset(binary[3000:], logcpm[3000:])

# Set up selector
selector = PROPOSE(train_dataset, train_dataset ,#val_dataset,
                   loss_fn=HurdleLoss(),
                   device=device, hidden=[128, 128])

And get an error:

--------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_792/260461855.py in <module>
      7 
      8 # Set up selector
----> 9 selector = PROPOSE(train_dataset, train_dataset ,#val_dataset,
     10                    loss_fn=HurdleLoss(),
     11                    device=device, hidden=[128, 128])

~/.local/lib/python3.8/site-packages/propose/selection.py in __init__(self, train_dataset, val_dataset, loss_fn, device, eta, preselected_inds, hidden, activation)
     47 
     48         # Initialize candidate genes.
---> 49         self.set_genes()
     50 
     51     def get_genes(self):

~/.local/lib/python3.8/site-packages/propose/selection.py in set_genes(self, candidates)
     68         # Set genes in datasets.
     69         included = np.sort(np.concatenate([candidates, self.preselected]))
---> 70         self.train.set_inds(included)
     71         self.val.set_inds(included)
     72 

~/.local/lib/python3.8/site-packages/propose/data.py in set_inds(self, inds, delete_remaining)
     64                 # Set input and inds.
     65                 self.inds = inds
---> 66                 self.data = self._data[:, inds]  
     67 
     68     def set_output_inds(self, inds, delete_remaining=False):

~/.local/lib/python3.8/site-packages/pandas/core/frame.py in __getitem__(self, key)
   3459             if is_iterator(key):
   3460                 key = list(key)
-> 3461             indexer = self.loc._get_listlike_indexer(key, axis=1)[1]
   3462 
   3463         # take() does not accept boolean indexers

~/.local/lib/python3.8/site-packages/pandas/core/indexing.py in _get_listlike_indexer(self, key, axis)
   1312             keyarr, indexer, new_indexer = ax._reindex_non_unique(keyarr)
   1313 
-> 1314         self._validate_read_indexer(keyarr, indexer, axis)
   1315 
   1316         if needs_i8_conversion(ax.dtype) or isinstance(

~/.local/lib/python3.8/site-packages/pandas/core/indexing.py in _validate_read_indexer(self, key, indexer, axis)
   1372                 if use_interval_msg:
   1373                     key = list(key)
-> 1374                 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
   1375 
   1376             not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique())

KeyError: "None of [Int64Index([   0,    1,    2,    3,    4,    5,    6,    7,    8,    9,\n            ...\n            6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423],\n           dtype='int64', length=6424)] are in the [columns]"

Am I doing something wrong? It's not super clear in the tutorial. Your raw_df, what are the rows there? I thought they would be each cell but maybe I misunderstood it, it only shows 4 rows..

Kind regards,
Ricardo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.