Skip to content

Instantly share code, notes, and snippets.

@nickinack

nickinack/f12.py

Last active Nov 22, 2020
Embed
What would you like to do?
def fitness_func(chromosome):
columns = []
for i in range(len(x_train.columns)):
if i in chromosome:
columns.append(x_train.columns[i])
dist.append(columns)
training_set = x_train[columns]
print(training_set)
test_set = x_test[columns]
lg = LinearRegression().fit(training_set.values, y_train.values)
preds = lg.predict(test_set.values)
return 100 / np.sqrt(mean_squared_error(y_test.values, preds))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.