Analysis of the iris data using Gaussian nave base analysis
The iris data includes the properties of vertical_length, vertical_width, petal_length, petal_width, and specifications. Using linear regression analysis, a classification model with vertical_length, vertical_width, petal_length, and petal_width as a feature array and specifications as labels can be found. Complete the Gaussian Naive Bayes analysis with reference to the following code.
import seaborn as sns
data = sns.load_dataset('iris')
# a flower of Buddha
X_iris = data.iloc[:, :-1]
# # y = target values, last column of the data frame
y_iris = data.iloc[:, -1]
from sklearn.model_selection import train_test_split
Xtrain, Xtest, ytrain, ytest = train_test_split(X_iris, y_iris,
test_size=0.25, random_state=1)
from sklearn.naive_bayes import GaussianNB
from sklearn.metrics import accuracy_score
I keep getting errors in the model fit y value in this problem. What should I do?
Is it working? It's too hard.ㅠ<
The code I wrote is the code below.
from sklearn.naive_bayes import GaussianNB
model=GaussianNB
import pandas as pd
import seaborn as sns
data = sns.load_dataset('iris')
# a flower of Buddha
from sklearn.datasets import load_iris
iris=load_iris()
X_iris = data.iloc[:, :-1]
# # y = target values, last column of the data frame
y_iris = data.iloc[:, -1]
from sklearn.model_selection import train_test_split
Xtrain, Xtest, ytrain, ytest = train_test_split(X_iris, y_iris,
test_size=0.25, random_state=1)
from sklearn.metrics import accuracy_score
from sklearn.naive_bayes import GaussianNB
model.fit(Xtest, ytest)
accuracy_score(Xtest.ytest)
model=GaussianNB()
© 2024 OneMinuteCode. All rights reserved.