commit
00d7ba9b5a
@ -0,0 +1,39 @@
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from sklearn.calibration import LabelEncoder
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.linear_model import LinearRegression
|
||||
|
||||
# Load data from CSV
|
||||
df = pd.read_csv("data\\data_emple.csv")
|
||||
|
||||
category = df.iloc[0:len(df),0].values
|
||||
|
||||
otherData = df.iloc[0:len(df),1:6].values
|
||||
|
||||
print(otherData)
|
||||
|
||||
# Encode the categorical target variable
|
||||
label_encoder = LabelEncoder()
|
||||
category_encoded = label_encoder.fit_transform(category)
|
||||
|
||||
model = LinearRegression()
|
||||
|
||||
model.fit(otherData,category_encoded)
|
||||
|
||||
|
||||
new_data = np.array([224.0,228.49,346.6000000000000,1.1007253886010361,101]).reshape(1, -1)
|
||||
|
||||
# Faites une prédiction avec le modèle entraîné
|
||||
prediction = model.predict(new_data)
|
||||
|
||||
# Affichez la prédiction
|
||||
print("Prédiction:", prediction)
|
||||
|
||||
# Supposons que label_encoder soit l'objet LabelEncoder que vous avez utilisé lors de l'entraînement
|
||||
inverse_prediction = label_encoder.inverse_transform(prediction.astype(int))
|
||||
|
||||
# Affichez la prédiction sous forme de chaîne de caractères
|
||||
print("Prédiction (en chaîne de caractères):", inverse_prediction)
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from sklearn.linear_model import LinearRegression
|
||||
from sklearn.model_selection import train_test_split
|
||||
df = pd.read_csv("data\\data_emple.csv")
|
||||
distance = df.iloc[0:len(df),1].values.reshape(-1, 1)
|
||||
time = df.iloc[0:len(df),2].values.reshape(-1, 1)
|
||||
|
||||
model = LinearRegression()
|
||||
|
||||
# Entrainement
|
||||
model.fit(time,distance)
|
||||
|
||||
# Afficher les coefficients du modèle
|
||||
print("Coefficients :", model.coef_)
|
||||
print("Intercept :", model.intercept_)
|
||||
|
||||
|
||||
# Supposons que vous avez de nouvelles données pour lesquelles vous voulez faire des prédictions
|
||||
new_time_data = np.array([1000]).reshape(1,-1) # Exemple de nouvelles données pour 'time'
|
||||
|
||||
# Faire des prédictions sur les nouvelles données
|
||||
predicted_distance = model.predict(new_time_data)
|
||||
|
||||
# Afficher les prédictions
|
||||
print("Prédictions de distance :", predicted_distance[0])
|
||||
|
||||
|
@ -0,0 +1,24 @@
|
||||
# IA
|
||||
|
||||
## Fonctionnement
|
||||
|
||||
Déterminé une activité pour l'utilisateur
|
||||
|
||||
### Data
|
||||
|
||||
Utiliser les activityInfo (vitesseAvg,BPM,....)
|
||||
|
||||
### Raisonnement
|
||||
|
||||
L'utilisateur pourra noter son activiter "Facile,moyen,dur" demander une note sur 100
|
||||
|
||||
### Calcul
|
||||
|
||||
En fonction de la note
|
||||
Il devra savoir et répondre une séance
|
||||
-> Vous devrez faire tant de km à x vitesse
|
||||
-> Vous serez entre x BPM
|
||||
-> Essayer de faire x denivelé
|
||||
-> .... etc
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:smartfit_app_mobile/common_widget/container/container_stats_activities.dart';
|
||||
import 'package:smartfit_app_mobile/modele/convertisseur.dart';
|
||||
|
||||
class VolumesList extends StatelessWidget {
|
||||
final Map<String, dynamic> volume;
|
||||
|
||||
const VolumesList({super.key, required this.volume});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var media = MediaQuery.of(context).size;
|
||||
|
||||
// TODO: True message with variables and context aware
|
||||
if (volume["nbActivity"] == 0) {
|
||||
return const Text("Aucune activité ces x jours/mois/années");
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ContainerStatsActivities(volume["nbActivity"].toString(),
|
||||
"Nombre Activitée(s)", Icons.numbers),
|
||||
SizedBox(
|
||||
width: media.width * 0.03,
|
||||
),
|
||||
ContainerStatsActivities(
|
||||
"${Convertisseur.secondeIntoMinute(volume["durationActiviy"]).toStringAsFixed(2)} m",
|
||||
"Temps Total",
|
||||
Icons.timer),
|
||||
SizedBox(
|
||||
width: media.width * 0.03,
|
||||
),
|
||||
ContainerStatsActivities(
|
||||
volume["bpmAvg"].toString(), "Bpm Moyens", Icons.favorite),
|
||||
SizedBox(
|
||||
width: media.width * 0.03,
|
||||
),
|
||||
ContainerStatsActivities(
|
||||
" ${Convertisseur.msIntoKmh(volume["speedAvg"]).toStringAsFixed(2)} km/h",
|
||||
"Vitesse Moyenne",
|
||||
Icons.bolt),
|
||||
SizedBox(
|
||||
width: media.width * 0.03,
|
||||
),
|
||||
ContainerStatsActivities(
|
||||
"${volume["denivelePositif"].toStringAsFixed(2)} m",
|
||||
"Dénivelé Positif",
|
||||
Icons.hiking),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:smartfit_app_mobile/common_widget/container/list/volumes_list.dart';
|
||||
import 'package:smartfit_app_mobile/common_widget/other/entete_home_view.dart';
|
||||
import 'package:smartfit_app_mobile/common/colo_extension.dart';
|
||||
import 'package:smartfit_app_mobile/modele/user.dart';
|
||||
import 'package:smartfit_app_mobile/modele/utile/home_view/data_home_view.dart';
|
||||
|
||||
class VolumesView extends StatefulWidget {
|
||||
const VolumesView({super.key});
|
||||
|
||||
@override
|
||||
State<VolumesView> createState() => _VolumesViews();
|
||||
}
|
||||
|
||||
class _VolumesViews extends State<VolumesView> {
|
||||
late DataHomeView data;
|
||||
TextEditingController bpmController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var media = MediaQuery.of(context).size;
|
||||
User user = context.watch<User>();
|
||||
DateTime date = DateTime.now();
|
||||
|
||||
Map<String, dynamic> volume7Days =
|
||||
user.getVolumeWhithDuration(const Duration(days: 7));
|
||||
Map<String, dynamic> volume1Months =
|
||||
user.getVolumeWhithDuration(const Duration(days: 30));
|
||||
Map<String, dynamic> volume1Year =
|
||||
user.getVolumeWhithDuration(const Duration(days: 366));
|
||||
Map<String, dynamic> volumeAllTime = user.getVolumeAllTime();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: TColor.white,
|
||||
body: SingleChildScrollView(
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: media.width * 0.03,
|
||||
),
|
||||
const EnteteHomeView(),
|
||||
SizedBox(
|
||||
height: media.width * 0.05,
|
||||
),
|
||||
Text(
|
||||
"Derniere semaine : ${date.day}/${date.month}/${date.year} - ${date.subtract(const Duration(days: 7)).day}/${date.subtract(const Duration(days: 7)).month}/${date.subtract(const Duration(days: 7)).year}",
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
SizedBox(
|
||||
height: media.width * 0.03,
|
||||
),
|
||||
VolumesList(volume: volume7Days),
|
||||
SizedBox(
|
||||
height: media.width * 0.03,
|
||||
),
|
||||
Text(
|
||||
"Dernier Mois : ${date.day}/${date.month}/${date.year} - ${date.subtract(const Duration(days: 30)).day}/${date.subtract(const Duration(days: 30)).month}/${date.subtract(const Duration(days: 30)).year}",
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
VolumesList(volume: volume1Months),
|
||||
SizedBox(
|
||||
height: media.width * 0.03,
|
||||
),
|
||||
Text(
|
||||
"Dernière année : ${date.day}/${date.month}/${date.year} - ${date.subtract(const Duration(days: 366)).day}/${date.subtract(const Duration(days: 366)).month}/${date.subtract(const Duration(days: 366)).year}",
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
VolumesList(volume: volume1Year),
|
||||
SizedBox(
|
||||
height: media.width * 0.03,
|
||||
),
|
||||
Text(
|
||||
"Total",
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
VolumesList(volume: volumeAllTime),
|
||||
SizedBox(
|
||||
height: media.width * 0.03,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue