<jupyter_start><jupyter_text>Read the CSV and Perform Basic Data Cleaning<jupyter_code># df = pd.read_csv("exoplanet_data.csv")
# # Drop the null columns where all values are null
# df = df.dropna(axis='columns', how='all')
# # Drop the null rows
# df = df.dropna()
# df.head()
import pandas as pd
df = pd.read_csv('cumulative.csv')

# print(len(df))

# # Drop the null columns where all values are null
# df = df.dropna(axis='columns', how='all')
# print(len(df))
# # Drop the null rows
# df = df.dropna()

# print(len(df))<jupyter_output><empty_output><jupyter_text>Select your features (columns)<jupyter_code>col_mapping = {
    # stellar parameters
    'koi_steff' : 'stellar effective temperature (Kelvin)'
    , 'koi_slogg' : 'stellar surface gravity (base-10 logarithm)'
    , 'koi_srad' : 'stellar radius (solar radii)'
    # exoplanet archive information
    , 'koi_disposition' : 'exoplanet archive disposition'
#     , 'kepoi_name' : 'kepler object of interest -- name'
    # identification columns
    , 'kepid' : 'target identification number'
    # transit properties
    , 'koi_period' : 'orbital period (days)'
    , 'koi_prad' : 'planetary radius (earth radii)'
    , 'koi_teq' : 'equilibrium temperature (kelvin)'

}

df = df[list(col_mapping)]
df.head()

display(df.count())
df.dtypes<jupyter_output><empty_output><jupyter_text>Create a Train Test SplitUse `koi_disposition` for the y values<jupyter_code># Assign X (data) and y (target)
label = 'koi_disposition'
X = df.drop(label, axis=1)
y = df[label]
print(X.shape, y.shape)

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=1, stratify=y)
import numpy as np
X_train.head()
# X_train.reshape(-1, 1)
# np.array(X_train).reshape(-1, 1)<jupyter_output><empty_output><jupyter_text>Pre-processingScale the data using the MinMaxScaler and perform some feature selection<jupyter_code>import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
# Scale your data
from sklearn.preprocessing import StandardScaler

# Create a StandardScater model and fit it to the training data

# np.array(X_train).reshape(-1, 1)
# X_scaler = StandardScaler().fit(X_train.reshape(-1, 1))
X_scaler = StandardScaler().fit(np.array(X_train).reshape(-1, 1))<jupyter_output><empty_output><jupyter_text>Train the Model<jupyter_code>print(f"Training Data Score: {model2.score(X_train_scaled, y_train)}")
print(f"Testing Data Score: {model2.score(X_test_scaled, y_test)}")<jupyter_output><empty_output><jupyter_text>Hyperparameter TuningUse `GridSearchCV` to tune the model's parameters<jupyter_code># Create the GridSearchCV model
# Train the model with GridSearch
print(grid2.best_params_)
print(grid2.best_score_)<jupyter_output><empty_output><jupyter_text>Save the Model<jupyter_code># save your model by updating "your_name" with your name
# and "your_model" with your model variable
# be sure to turn this in to BCS
# if joblib fails to import, try running the command to install in terminal/git-bash
import joblib
filename = 'your_name.sav'
joblib.dump(your_model, filename)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11570502931194077, 'fraction_numerical': 0.005553841406973156, 'mean_word_length': 6.032537960954447, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '176834', 'license': 'ADSL', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1125, 'n_words': 285, 'path': 'starter_code/.ipynb_checkpoints/model_1-checkpoint.ipynb', 'repo_name': 'william-cass-wright/machine-learning-challenge', 'size': '3241'}