Comments (3)
Proposal for NeuralNet.__repr__()
:
def __repr__(self):
params = self.get_params(deep=False)
if self.initialized_:
parts = ['initialized ' + str(self.__class__) + ' (']
else:
parts = ['uninitialized ' + str(self.__class__) + ' (']
if params['history']:
history = params.pop('history')
params['history'] = 'history=[...], # {} epochs'.format(len(history))
for key, val in sorted(params.items()):
val = str(val)
if '\n' in val:
val = '\n '.join(val.split('\n'))
parts.append(' {}={},'.format(key, val))
parts.append(')')
return '\n'.join(parts)
Result for an uninitialized net (module from notebook):
net = net = MyNet(
MyModule,
max_epochs=20,
lr=0.1,
module__num_units=123,
module__dropout=0.33,
optim__lr=0.22,
iterator_train__shuffle=True,
callbacks=[callbacks.EpochTimer, ('epoch2', callbacks.EpochTimer())],
callbacks__epoch2__foo='bar',
)
# ==>
uninitialized <class '__main__.MyNet'> (
batch_size=128,
callbacks=[<class 'inferno.callbacks.EpochTimer'>, ('epoch2', <inferno.callbacks.EpochTimer object at 0x7fc530540160>)],
callbacks__epoch2__foo=bar,
cold_start=True,
criterion=<class 'torch.nn.modules.loss.NLLLoss'>,
dataset=<class 'inferno.dataset.Dataset'>,
gradient_clip_norm_type=2,
gradient_clip_value=None,
history=None,
initialized_=False,
iterator_test=<class 'torch.utils.data.dataloader.DataLoader'>,
iterator_train=<class 'torch.utils.data.dataloader.DataLoader'>,
iterator_train__shuffle=True,
lr=0.1,
max_epochs=20,
module=<class '__main__.MyModule'>,
module__dropout=0.33,
module__num_units=123,
optim=<class 'torch.optim.sgd.SGD'>,
optim__lr=0.22,
train_split=<inferno.dataset.CVSplit object at 0x7fc535cacc50>,
use_cuda=False,
verbose=1,
)
After fitting:
initialized <class '__main__.MyNet'> (
batch_size=128,
callbacks=[<class 'inferno.callbacks.EpochTimer'>, ('epoch2', <inferno.callbacks.EpochTimer object at 0x7fc530540160>)],
callbacks_=[('epoch_timer', <inferno.callbacks.EpochTimer object at 0x7fc535c98fd0>), ('train_loss', <inferno.callbacks.Scoring object at 0x7fc535d14828>), ('valid_loss', <inferno.callbacks.Scoring object at 0x7fc535d14f28>), ('valid_acc', <inferno.callbacks.Scoring object at 0x7fc59ad08e10>), ('EpochTimer', <inferno.callbacks.EpochTimer object at 0x7fc530534a90>), ('epoch2', <inferno.callbacks.EpochTimer object at 0x7fc530540160>), ('print_log', <inferno.callbacks.PrintLog object at 0x7fc59acf6f98>)],
callbacks__epoch2__foo=bar,
cold_start=True,
criterion=<class 'torch.nn.modules.loss.NLLLoss'>,
criterion_=NLLLoss (
),
dataset=<class 'inferno.dataset.Dataset'>,
gradient_clip_norm_type=2,
gradient_clip_value=None,
history=history=[...], # 20 epochs,
initialized_=True,
iterator_test=<class 'torch.utils.data.dataloader.DataLoader'>,
iterator_train=<class 'torch.utils.data.dataloader.DataLoader'>,
iterator_train__shuffle=True,
lr=0.1,
max_epochs=20,
module=<class '__main__.MyModule'>,
module_=MyModule (
(dense0): Linear (20 -> 123)
(dropout): Dropout (p = 0.33)
(dense1): Linear (123 -> 10)
(output): Linear (10 -> 2)
),
module__dropout=0.33,
module__num_units=123,
optim=<class 'torch.optim.sgd.SGD'>,
optim_=<torch.optim.sgd.SGD object at 0x7fc530540198>,
optim__lr=0.22,
train_split=<inferno.dataset.CVSplit object at 0x7fc535cacc50>,
use_cuda=False,
verbose=1,
)
from skorch.
I think the current representation works well and #126 resolved this issue.
What's your opionion @benjamin-work?
from skorch.
IMO good enough for now.
from skorch.
Related Issues (20)
- IndexError: invalid index of a 0-dim tensor. Use `tensor.item()` in Python or `tensor.item()` in C++ to convert a 0-dim tensor to a number HOT 8
- Enable using a generator as data loader
- Question: weird valid loss when re-scaling y
- Issues in braindecode recently introduced by skorch HOT 3
- ReadTheDocs: Wrong theme of docs
- How to tune number of epochs?
- Issues with deployment script
- dill load and sklearn clone result in error HOT 7
- how to integrate pytorch-tabnet into skorch framework? HOT 2
- ImportError: cannot import name 'uses_placeholder_y' from 'skorch.dataset' HOT 1
- Saving and Loading not working HOT 2
- Add slides for Pydata Amsterdam HOT 3
- model.history not save output of all epochs HOT 2
- I can't use gpu cuda tensor with NeuralNet HOT 1
- Permit to pass '**predict_params' to 'predict' method as for 'fit' method HOT 2
- Skorch forwarding data columns as kwargs when using gridsearchcv HOT 4
- Skorch weird handling of input data HOT 3
- LLM caching breaks with shared-prefix labels under certain conditions HOT 3
- Activating (deactivating) callbacks at specific epochs or milestones and SequentialLR HOT 1
- Dictionary Input and Custom Collate Function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skorch.