// MathJax

Perceptron

from sklearn.datasets import make_classification, make_regression
from sklearn.linear_model import Perceptron

X, y = make_classification(n_samples=3000, n_features=10, n_classes=3, n_clusters_per_class=1, weights=[.6, .3, .1], flip_y=0)
classifier = Perceptron(penalty=None, alpha=0.0001, l1_ratio=0.15, fit_intercept=True, max_iter=1000, tol=0.001, shuffle=True, verbose=0, eta0=1.0, n_jobs=None, random_state=0, early_stopping=False, validation_fraction=0.1, n_iter_no_change=5, class_weight=None, warm_start=False)
classifier.fit(X, y)
classifier.predict(X)

Validation

#

 

 


Multi Layer Perceptron

from sklearn.datasets import make_classification, make_regression
from sklearn.neural_network import MLPClassifier, MLPRegressor

X, y = make_classification(n_samples=3000, n_features=10, n_classes=3, n_clusters_per_class=1, weights=[.6, .3, .1], flip_y=0)
classifier = MLPClassifier(hidden_layer_sizes=(100,), max_iter=1000, activation='relu', solver='adam', learning_rate='adaptive')
classifier.fit(X, y)
classifier.predict(X)
classifier.predict_proba(X)

X, y = make_regression(n_samples=3000, n_features=10, n_informative=5, n_targets=1, bias=0.0, effective_rank=None, tail_strength=0.5, noise=0.0, shuffle=True, coef=False, random_state=None)
regressor = MLPRegressor(hidden_layer_sizes=(100,), max_iter=1000, activation='relu', solver='adam', learning_rate='adaptive')
regressor.fit(X, y)
regressor.predict(X)

Validation

#

 

 

 


Reference

'artificial intelligence > machine learning' 카테고리의 다른 글

Hidden Markov Model  (0) 2023.05.09
K-mean Clustering Model  (0) 2023.05.09
SVM Model  (0) 2023.05.09
K-Nearest and Radius Neighbor Model  (0) 2023.05.09
Ensemble Model  (0) 2023.05.09

+ Recent posts