# Python Gaussian Naive Bayes Analysis Example Question.

Asked 2 weeks ago, Updated 2 weeks ago, 1 views

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

# 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

# a flower of Buddha

from sklearn.datasets import 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)
``````

python sklearn iris

2022-09-20 11:11

`model=GaussianNB()`

2022-09-20 11:11

## If you have any answers or tips

Popular Tags
python x 4519
android x 1589
java x 1455
javascript x 1363
c x 881
php x 682
html x 629
swift x 586
ios x 538
mysql x 397