polylearn.
FactorizationMachineClassifier
(degree=2, loss=’squared_hinge’, n_components=2, alpha=1, beta=1, tol=1e-06, fit_lower=’explicit’, fit_linear=True, warm_start=False, init_lambdas=’ones’, max_iter=10000, verbose=False, random_state=None)[source]¶Factorization machine for classification.
Parameters: | degree : int >= 2, default: 2
loss : {‘logistic’|’squared_hinge’|’squared’}, default: ‘squared_hinge’
n_components : int, default: 2
alpha : float, default: 1
beta : float, default: 1
tol : float, default: 1e-6
fit_lower : {‘explicit’|’augment’|None}, default: ‘explicit’
fit_linear : {True|False}, default: True
warm_start : boolean, optional, default: False
init_lambdas : {‘ones’|’random_signs’}, default: ‘ones’
max_iter : int, optional, default: 10000
verbose : boolean, optional, default: False
random_state : int seed, RandomState instance, or None (default)
|
---|---|
Attributes: | self.P_ : array, shape [n_orders, n_components, n_features]
self.w_ : array, shape [n_features]
self.lams_ : array, shape [n_components]
|
References
Polynomial Networks and Factorization Machines: New Insights and Efficient Training Algorithms. Mathieu Blondel, Masakazu Ishihata, Akinori Fujino, Naonori Ueda. In: Proceedings of ICML 2016. http://mblondel.org/publications/mblondel-icml2016.pdf
Factorization machines. Steffen Rendle In: Proceedings of IEEE 2010.
Methods
decision_function (X) |
Compute the output of the factorization machine before thresholding. |
fit (X, y) |
Fit factorization machine to training data. |
get_params ([deep]) |
Get parameters for this estimator. |
predict (X) |
Predict using the factorization machine |
predict_proba (X) |
Compute probability estimates for the test samples. |
score (X, y[, sample_weight]) |
Returns the mean accuracy on the given test data and labels. |
set_params (**params) |
Set the parameters of this estimator. |
__init__
(degree=2, loss=’squared_hinge’, n_components=2, alpha=1, beta=1, tol=1e-06, fit_lower=’explicit’, fit_linear=True, warm_start=False, init_lambdas=’ones’, max_iter=10000, verbose=False, random_state=None)[source]¶decision_function
(X)¶Compute the output of the factorization machine before thresholding.
Parameters: | X : {array-like, sparse matrix}, shape = [n_samples, n_features]
|
---|---|
Returns: | y_scores : array, shape = [n_samples]
|
fit
(X, y)¶Fit factorization machine to training data.
Parameters: | X : array-like or sparse, shape = [n_samples, n_features]
y : array-like, shape = [n_samples]
|
---|---|
Returns: | self : Estimator
|
get_params
(deep=True)¶Get parameters for this estimator.
Parameters: | deep : boolean, optional
|
---|---|
Returns: | params : mapping of string to any
|
predict
(X)¶Predict using the factorization machine
Parameters: | X : {array-like, sparse matrix}, shape = [n_samples, n_features]
|
---|---|
Returns: | y_pred : array, shape = [n_samples]
|
predict_proba
(X)¶Compute probability estimates for the test samples.
Only available if loss=’logistic’.
Parameters: | X : {array-like, sparse matrix}, shape = [n_samples, n_features]
|
---|---|
Returns: | y_scores : array, shape = [n_samples]
|
score
(X, y, sample_weight=None)¶Returns the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.
Parameters: | X : array-like, shape = (n_samples, n_features)
y : array-like, shape = (n_samples) or (n_samples, n_outputs)
sample_weight : array-like, shape = [n_samples], optional
|
---|---|
Returns: | score : float
|
set_params
(**params)¶Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each
component of a nested object.
Returns: | self : |
---|