Skip to content

Instantly share code, notes, and snippets.

@mjesusugarte
Created March 5, 2021 12:54
Show Gist options
  • Save mjesusugarte/23acf1198fa7da415ba50a13d861c9f9 to your computer and use it in GitHub Desktop.
Save mjesusugarte/23acf1198fa7da415ba50a13d861c9f9 to your computer and use it in GitHub Desktop.
target_column_name = 'charges'
train_percentage = 0.7
cal_percentage = 0.2
X = df.drop(columns=target_column_name).to_numpy()
Y = df[target_column_name].to_numpy()
n_total = X.shape[0]
n_train = int(train_percentage*n_total)
n_cal = int(cal_percentage*n_total) + n_train
train_data = X[:n_train, :]
train_target = Y[:n_train]
cal_data = X[n_train:n_cal, :]
cal_target = Y[n_train:n_cal]
test_data = X[n_cal:, :]
test_target = Y[n_cal:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment