# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import pandas as pd
import numpy as np
import statsmodels.api as sm
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()

df = pd.read_csv('delldata_final.csv')
df

test_frame = pd.read_csv('testcases.csv')
test_frame.head()

feature_names = df.columns
feat_names = list(feature_names)
feat_names

df2 = df.iloc[:, 0:6]
df2

df3 = test_frame.iloc[:, 0:6]
df3

matrix_X = []
for index, rows in df2.iterrows(): 
    row = list(rows)
    matrix_X.append(row)
matrix_X 

test_X = []
for index, rows in df3.iterrows(): 
    row = list(rows)
    test_X.append(row)
test_X 

y_train = df['Warranty Recommended']
list(y_train)
y_train = np.array(y_train)
y_train

y_test = test_frame['Warranty Recommended']
list(y_test)
y_test = np.array(y_test)
y_test

from sklearn.neighbors import KNeighborsClassifier
neigh = KNeighborsClassifier(n_neighbors=3)
neigh.fit(matrix_X, y_train)
predicted_values = neigh.predict(test_X)

predicted_values

from sklearn.neighbors import KNeighborsClassifier
neigh = KNeighborsClassifier(n_neighbors=3)
neigh.fit(matrix_X, y_train)
predicted_value = neigh.predict([[1,1,0,0,0,0]])
predicted_value



StarcoderdataJupyterScriptsDedupFiltered