nutshel all major supervised algo.

drop down your ans. type down an understand all the basic model

stay motivated.for any querry .... coment.

 import numpy as np
from sklearn.linear_model import LinearRegression
x= np.array([[1,1],[1,2],[3,4],[5,6]])
y = np.dot(x,np.array([1,2])) + 3
reg = LinearRegression().fit(x,y)
reg.score(x,y)reg.predict(np.array([[3,5]]))

..........................................................................................

from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
X,y= load_iris(return_X_y=True)
clf = LogisticRegression(random_state=0).fit(X,y)
clf.predict(X[:2,:])
clf.score(X,y)
.....................................................................................

x=[[0],[1],[2],[3]]
y=[0,0,1,1]
from sklearn.neighbors import KNeighborsClassifier
neigh= KNeighborsClassifier(n_neighbors=3)
neigh.fit(x,y)
neigh.predict([[1.1]])
neigh.predict_proba([[0.9]])

.........................................................................................

import numpy as np
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
x = np.array([[-1,-1],[-2,-1],[1,1],[2,1]])
y= np.array([1,1,2,2])
clf = make_pipeline(StandardScaler(),SVC(gamma="auto"))
clf.fit(x,y)
clf.predict([[-0.8,-1]])
............................................................................................

import numpy as np
x= np.array([[-1,-1],[-2,-1],[-3,-2],[1,1],[2,1],[3,2]])
y= np.array([1,1,1,2,2,2])
from sklearn.naive_bayes import GaussianNB
clf= GaussianNB()
clf.fit(x,y)
clf.predict([[-0.8,-1]])

Comments

Popular posts from this blog

environment creation on python

scatterplot/ violon plot /histogram /boxplot

Pcb Fault Detection(Deep Learning Technique)