11. Write a program for Naive Bayesian Classification in Python
import pandas as pd
import numpy as np
from sklearn import datasets
iris = datasets.load_iris() # importing the dataset
iris.data # showing the iris data
X=iris.data #assign the data to the X
y=iris.target #assign the target/flower type to the y
print (X.shape)
print (y.shape)
fromsklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=9)
fromsklearn.naive_bayes import GaussianNB
nv = GaussianNB() # create a classifier
nv.fit(X_train,y_train) # fitting the data
fromsklearn.metrics import accuracy_score
y_pred = nv.predict(X_test) # store the prediction data
accuracy_score(y_test,y_pred) # calculate the accuracy
Explore machine learning tool“WEKA”//2.a// Explore WEKA Data Mining/Machine Learning Toolkit. ANS: WEKA(Waikato Environment for Knowledge Analysis) an open-source software provides tools for data preprocessing, implementation of several Machine Learning algorithms, and visualization tools so that we can develop machine learning techniques and apply them to real-world data mining problems. Features of WEKA - Preprocessor – Most of the Data is Raw. Hence, Preprocessor is used to clean the noisy data. Classify – After preprocessing the data, we assign classes or categories to items. Cluster – In Clustering, a dataset is arranged in different groups/clusters based on some similarities. Associate – Association rules highlight all the associations and correlations between items of a dataset. Select Attributes – Every dataset contains a lot of attributes; only significantly valuable attributes are selected for building a good model. Visualize – In Visualization, different plot matrices ...
Comments
Post a Comment