## 2017年11月9日 星期四

### Multi-layer Perceptron classifier

sklearn.linear_model.LogisticRegression
This model optimizes the log-loss function using LBFGS or stochastic gradient descent.

solver : 要使用那一種演算法去解最佳化的問題, 如 weight optimization.

solver : {‘newton-cg’, ‘lbfgs’, ‘liblinear’, ‘sag’, ‘saga’},
default: ‘liblinear’ Algorithm to use in the optimization problem.

batch_size : int, optional, default ‘auto’
Size of minibatches for stochastic optimizers. If the solver is ‘lbfgs’, the classifier will not use minibatch. When set to “auto”, batch_size=min(200, n_samples)

max_iter : int, optional, default 200
Maximum number of iterations. The solver iterates until convergence (determined by ‘tol’) or this number of iterations. For stochastic solvers (‘sgd’, ‘adam’), note that this determines the number of epochs (how many times each data point will be used), not the number of gradient steps.
that is , total parameter update= (# of batch_size) * (# of epochs)

tol : float, optional, default 1e-4
Tolerance for the optimization. When the loss or score is not improving by at least tol for two consecutive iterations, unless learning_rate is set to ‘adaptive’, convergence is considered to be reached and training stops.
momentum : float, default 0.9
Momentum for gradient descent update. Should be between 0 and 1. Only used when solver=’sgd’.
early_stopping : bool, default False
Whether to use early stopping to terminate training when validation score is not improving. If set to true, it will automatically set aside 10% of training data as validation and terminate training when validation score is not improving by at least tol for two consecutive epochs. Only effective when solver=’sgd’ or ‘adam’
validation_fraction : float, optional, default 0.1
The proportion of training data to set aside as validation set for early stopping. Must be between 0 and 1. Only used if early_stopping is True

 fit(X, y) Fit the model to data matrix X and target(s) y. get_params([deep]) Get parameters for this estimator. predict(X) Predict using the multi-layer perceptron classifier predict_log_proba(X) Return the log of probability estimates. predict_proba(X) Probability estimates. 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.

predict_proba(X) Probability estimates. The returned estimates for all classes are ordered by the label of classes.

Y=predict_proba(X) is a method of a (soft) classifier outputting the probability of the instance being in each of the classes.
Y 是一個list, 列出X 會落在Y分類中的機率值