0% found this document useful (0 votes)
22 views2 pages

Null 1

programs

Uploaded by

shamantanayak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Null 1

programs

Uploaded by

shamantanayak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import numpy as np

import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn import svm
from sklearn.metrics import accuracy_score
# loading the diabetes dataset to a pandas DataFrame
autism_dataset = pd.read_csv("asd_data_csv.csv")
#autism_dataset = pd.read_csv("/content/asd_data_csv.csv")
# printing the first 5 rows of the dataset
autism_dataset.head()
# number of rows and Columns in this dataset
autism_dataset.shape
# getting the statistical measures of the data
autism_dataset.describe()
autism_dataset['Outcome'].value_counts()
autism_dataset.groupby('Outcome').mean()
X = autism_dataset.drop(columns = 'Outcome', axis=1)
Y = autism_dataset['Outcome']
print(X)
print(Y)
scaler = StandardScaler()
scaler.fit(X)
standardized_data = scaler.transform(X)
print(standardized_data)
X = standardized_data
Y = autism_dataset['Outcome']
print(X)
print(Y)
X_train, X_test, Y_train, Y_test = train_test_split(X,Y, test_size = 0.2,
stratify=Y, random_state=2)
print(X.shape, X_train.shape, X_test.shape)
classifier = svm.SVC(kernel='linear')
classifier.fit(X_train, Y_train)
X_train_prediction = classifier.predict(X_train)
training_data_accuracy = accuracy_score(X_train_prediction, Y_train)
print('Accuracy score of the training data : ', training_data_accuracy)
X_test_prediction = classifier.predict(X_test)
test_data_accuracy = accuracy_score(X_test_prediction, Y_test)
print('Accuracy score of the test data : ', test_data_accuracy)
# input_data = (3,18,1,1,1,1,1,1,2,1,0,1,1)
input_data = (0,4,0,0,0,0,0,0,1,0,1,0)
# changing the input_data to numpy array
input_data_as_numpy_array = np.asarray(input_data)

# reshape the array as we are predicting for one instance


input_data_reshaped = input_data_as_numpy_array.reshape(1,-1)

# standardize the input data


std_data = scaler.transform(input_data_reshaped)
print(std_data)

prediction = classifier.predict(std_data)
print(prediction)

if (prediction[0] == 0):
print('The person is not with Autism spectrum disorder')
else:
print('The person is with Autism spectrum disorder')
import pickle
pickle.dump(autism_dataset,open("autism_dataset.pkl","wb"))

You might also like