ezmsg.learn.process.sgd#
Functions
- sgd_decoder(alpha=1.5e-05, eta0=1e-07, loss='squared_hinge', label_weights=None, settings_path=None)[source]#
Passive Aggressive Classifier Online Passive-Aggressive Algorithms <http://jmlr.csail.mit.edu/papers/volume7/crammer06a/crammer06a.pdf> K. Crammer, O. Dekel, J. Keshat, S. Shalev-Shwartz, Y. Singer - JMLR (2006)
- Parameters:
alpha (
float) – Maximum step size (regularization)eta0 (
float) – The initial learning rate for the ‘adaptive’ schedules.loss (
str) – The loss function to be used: hinge: equivalent to PA-I in the reference paper. squared_hinge: equivalent to PA-II in the reference paper.label_weights (
dict[str,float] |None) – An optional dictionary of label names and their relative weight. e.g., {‘Go’: 31.0, ‘Stop’: 0.5} If this is None then settings_path must be provided and the pre-trained modelsettings_path (
str|None) – Path to the stored sklearn model pkl file.
- Return type:
Generator[AxisArray|SampleMessage,ClassifierMessage|None,None]- Returns:
Generator that accepts SampleMessage for incremental training (partial_fit) and yields None, or AxisArray for inference (predict) and yields a ClassifierMessage.
Classes
- class SGDDecoder(*args, settings=None, **kwargs)[source]#
Bases:
GenAxisArray- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
SGDDecoderSettings
- INPUT_SAMPLE = InputStream:unlocated[<class 'ezmsg.baseproc.util.message.SampleMessage'>]()#
- async on_sample(msg)[source]#
- Return type:
- Parameters:
msg (SampleMessage)
- class SGDDecoderSettings(alpha=1e-05, eta0=0.0003, loss='hinge', label_weights=None, settings_path=None)[source]#
Bases:
Settings- Parameters:
- sgd_decoder(alpha=1.5e-05, eta0=1e-07, loss='squared_hinge', label_weights=None, settings_path=None)[source]#
Passive Aggressive Classifier Online Passive-Aggressive Algorithms <http://jmlr.csail.mit.edu/papers/volume7/crammer06a/crammer06a.pdf> K. Crammer, O. Dekel, J. Keshat, S. Shalev-Shwartz, Y. Singer - JMLR (2006)
- Parameters:
alpha (
float) – Maximum step size (regularization)eta0 (
float) – The initial learning rate for the ‘adaptive’ schedules.loss (
str) – The loss function to be used: hinge: equivalent to PA-I in the reference paper. squared_hinge: equivalent to PA-II in the reference paper.label_weights (
dict[str,float] |None) – An optional dictionary of label names and their relative weight. e.g., {‘Go’: 31.0, ‘Stop’: 0.5} If this is None then settings_path must be provided and the pre-trained modelsettings_path (
str|None) – Path to the stored sklearn model pkl file.
- Return type:
Generator[AxisArray|SampleMessage,ClassifierMessage|None,None]- Returns:
Generator that accepts SampleMessage for incremental training (partial_fit) and yields None, or AxisArray for inference (predict) and yields a ClassifierMessage.
- class SGDDecoderSettings(alpha=1e-05, eta0=0.0003, loss='hinge', label_weights=None, settings_path=None)[source]#
Bases:
Settings- Parameters:
- class SGDDecoder(*args, settings=None, **kwargs)[source]#
Bases:
GenAxisArray- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
SGDDecoderSettings
- INPUT_SAMPLE = InputStream:unlocated[<class 'ezmsg.baseproc.util.message.SampleMessage'>]()#
- async on_sample(msg)[source]#
- Return type:
- Parameters:
msg (SampleMessage)