-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b230aa2
commit 164e741
Showing
3 changed files
with
223 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,11 @@ | ||
from sklearn.preprocessing import minmax_scale | ||
from thefittest.classifiers._mlpeaclassifier import MLPClassifierEA2 | ||
from thefittest.optimizers import SHADE | ||
from sklearn.utils.estimator_checks import check_estimator | ||
|
||
model = MLPClassifierEA2(iters=500, pop_size=250, | ||
hidden_layers=(5,), | ||
activation="relu", | ||
weights_optimizer=SHADE, | ||
weights_optimizer_args={"show_progress_each": 50}) | ||
|
||
def minmax_scale(data): | ||
data_copy = data.copy() | ||
max_value = data_copy.max() | ||
min_value = data_copy.min() | ||
if max_value == min_value: | ||
scaled_data = np.ones_like(data_copy, dtype=np.float64) | ||
else: | ||
scaled_data = ((data_copy - min_value) / (max_value - min_value)).astype(np.float64) | ||
return scaled_data | ||
|
||
|
||
|
||
import numpy as np | ||
|
||
# Example data | ||
example_data = np.random.uniform(-100, 100, size = 10).astype(np.float64)*0 + 1 | ||
|
||
# Scale the data using the scale_data function | ||
scaled_data = scale_data(example_data) | ||
scaled_data2 = minmax_scale(example_data) | ||
|
||
# Display original and scaled data | ||
print("Original Data:", example_data) | ||
print("Scaled Data:", scaled_data) | ||
print("Scaled Data 2:", scaled_data2) | ||
|
||
from thefittest.utils.random import random_weighted_sample | ||
|
||
print(random_weighted_sample(scaled_data, 10, False)) | ||
|
||
print(random_weighted_sample(scaled_data2, 10, False)) | ||
print(check_estimator(model)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters