def print_property_values(labels, values):
    for idx, value in enumerate(values):
        print(f"{labels[idx]}: {value}")
    print()


# Data rows are in the format of [difficulty_rating],[bpm],[total_length],[cs],[drain],[accuracy],[ar].
labels = [
    DIFFICULTY_LABEL, BPM_LABEL, LENGTH_LABEL, CS_LABEL, DRAIN_LABEL,
    ACCURACY_LABEL, AR_LABEL
]
filename_labels = []
for label in labels:
    filename_labels.append(label.lower().replace(" ", "_"))
# Keep track of each property in separate rows.
points = np.transpose(models_util.load_metadata_dataset())

mins = points.min(axis=-1)
maxes = points.max(axis=-1)
means = np.mean(points, axis=-1)

print("Minimum values:")
print_property_values(labels, mins)

print("Maximum values:")
print_property_values(labels, maxes)

print("Mean values:")
print_property_values(labels, means)

# Plot graphs for each input output feature pair.
from sklearn.neural_network import MLPRegressor
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler

from models import models_util

dataset = models_util.load_metadata_dataset()
# Difficulty and BPM input features.
X_train = dataset[:, 0:2]
y = dataset[:, 4]

model = make_pipeline(StandardScaler(), MLPRegressor(hidden_layer_sizes=(7, )))
model.fit(X_train, y)

models_util.save_model(model, models_util.MetadataPredictor.DRAIN)
print("Trained model saved.")