import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import numpy as np
# Загрузка датасета
data = pd.read_csv("dataset-of-10s.csv")
# Шаг 1: Выбери признаки для модели
features = ['danceability', 'energy', 'loudness', 'speechiness',
'acousticness', 'instrumentalness', 'liveness',
'valence', 'tempo', 'duration_ms']
|
|
|
# Шаг 2: Раздели на train и test
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)
|
|
|
print(f"{accuracy * 100:.2f}") # Точность модели
|