Skip to content

Commit c588872

Browse files
committed
pandas dataframe for model, numpy array for fit
1 parent 0c1f8e4 commit c588872

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

experiment/test_population.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ def test_population(ml):
4747
sample_idx = np.random.choice(np.arange(len(X_train)), size=10)
4848

4949
y_train = y_train[sample_idx]
50-
X_train = X_train.iloc[sample_idx].values
50+
X_train = X_train.iloc[sample_idx]
5151

52-
algorithm.est.fit(X_train, y_train)
52+
algorithm.est.fit(X_train.values, y_train)
5353

5454
if 'get_population' not in dir(algorithm):
5555
algorithm.get_population = lambda est: [est]
@@ -59,11 +59,11 @@ def test_population(ml):
5959
population = algorithm.get_population(algorithm.est)
6060
best_model = algorithm.get_best_solution(algorithm.est)
6161
print(algorithm.model(best_model, X_train))
62-
print(algorithm.est.predict(X_train))
62+
print(algorithm.est.predict(X_train.values))
6363

6464
# assert that population has at least 1 and no more than 100 individuals
6565
assert 1 <= len(population) <= 100, "Population size is not within the expected range"
6666

6767
for p in population:
6868
print(algorithm.model(p, X_train))
69-
print(p.predict(X_train))
69+
print(p.predict(X_train.values))

0 commit comments

Comments
 (0)