kinoml.ml.lightning_modules
¶
Training loops built with pytorch-lightning
WIP
Module Contents¶
- class kinoml.ml.lightning_modules.RootMeanSquaredError¶
Bases:
pytorch_lightning.metrics.MeanSquaredError
WIP
- compute()¶
WIP
- class kinoml.ml.lightning_modules.ObservationModelModule(nn_model, optimizer, loss_function, validate=True)¶
Bases:
pytorch_lightning.LightningModule
WIP
- forward(x, observation_model=_null_observation_model)¶
WIP
- _standard_step(batch, batch_idx, **kwargs)¶
WIP
- training_step(batch, batch_idx, **kwargs)¶
WIP
- _common_validation_test_step(batch, batch_idx, dataloader_idx=0, metric_prefix='val', **kwargs)¶
WIP
- _common_validation_test_epoch_end(output_results, metric_prefix='val')¶
WIP
- _disabled_validation_step(*args, **kwargs)¶
WIP
- _disabled_validation_epoch_end(*args, **kwargs)¶
WIP
- test_step(*args, **kwargs)¶
WIP
- test_epoch_end(*args, **kwargs)¶
WIP
- configure_optimizers()¶
WIP
- class kinoml.ml.lightning_modules.MultiDataModule(datasets: List[torch.utils.data.Dataset], observation_models: List[callable] = (_null_observation_model,), **kwargs)¶
Bases:
pytorch_lightning.LightningDataModule
WIP
- property active_dataset¶
WIP
- property active_dataset_index¶
WIP
- dataset_indices_by_size(reverse=False)¶
WIP
- _build_dataloader(dataset_index=None, indices=None)¶
WIP
- train_dataloader(dataset_index=None)¶
WIP
- val_dataloader(dataset_index=None)¶
WIP
- test_dataloader(dataset_index=None)¶
WIP
- get_kfold(nfolds=5, with_validation=True, shuffle=False, **kwargs)¶
WIP
- class kinoml.ml.lightning_modules.CrossValidateTrainer(nfolds=5, with_validation=True, shuffle=False, *args, **kwargs)¶
WIP
- fit(model, datamodule)¶
WIP
- _patch_paths_for_kfold(fold_trainer, fold)¶
WIP
- test(dataset_index=0, **kwargs)¶
WIP
- best_run()¶
WIP
- clear()¶
WIP
- class kinoml.ml.lightning_modules.ObservationModelDataLoader(observation_model=_null_observation_model, *args, **kwargs)¶
Bases:
torch.utils.data.DataLoader
WIP
- __iter__()¶
- class kinoml.ml.lightning_modules._IterWithObsModel(iterator, observation_model)¶
WIP
- __getattr__(name: str)¶
- __next__()¶
- __iter__()¶
- class kinoml.ml.lightning_modules.AttrList(*args, **kwargs)¶
Bases:
list
A subclass of list that can accept additional attributes. Should be able to be used just like a regular list.
The problem: a = [1, 2, 4, 8] a.x = “Hey!” # AttributeError: ‘list’ object has no attribute ‘x’
The solution: a = L(1, 2, 4, 8) a.x = “Hey!” print a # [1, 2, 4, 8] print a.x # “Hey!” print len(a) # 4
You can also do these: a = L( 1, 2, 4, 8 , x=”Hey!” ) # [1, 2, 4, 8] a = L( 1, 2, 4, 8 )( x=”Hey!” ) # [1, 2, 4, 8] a = L( [1, 2, 4, 8] , x=”Hey!” ) # [1, 2, 4, 8] a = L( {1, 2, 4, 8} , x=”Hey!” ) # [1, 2, 4, 8] a = L( [2 ** b for b in range(4)] , x=”Hey!” ) # [1, 2, 4, 8] a = L( (2 ** b for b in range(4)) , x=”Hey!” ) # [1, 2, 4, 8] a = L( 2 ** b for b in range(4) )( x=”Hey!” ) # [1, 2, 4, 8] a = L( 2 ) # [2]
Taken from https://code.activestate.com/recipes/579103-python-addset-attributes-to-list/
- __call__(**kwargs)¶