Browse Source

ajout extension .py

Paul Faure 2 years ago
parent
commit
c7b9e02f93
2 changed files with 0 additions and 40 deletions
  1. 0
    40
      tp-preprocessing
  2. 0
    0
      tp6-preprocessing.py

+ 0
- 40
tp-preprocessing View File

@@ -1,40 +0,0 @@
1
-#!/usr/bin/env python3
2
-# -*- coding: utf-8 -*-
3
-"""
4
-Created on Sun Jan  9 11:12:30 2022
5
-
6
-@author: pfaure
7
-"""
8
-from sklearn.neighbors import NearestNeighbors
9
-import numpy as np
10
-
11
-from myplotlib import print_1d_data, print_2d_data
12
-from mydatalib import extract_data_csv, scale_data
13
-
14
-path = './new-data/'
15
-dataset_name = "pluie"
16
-save = False
17
-
18
-print("-----------------------------------------------------------")
19
-print("     Chargement du dataset : " + dataset_name)
20
-(villes, data) = extract_data_csv(path + dataset_name, 13, 13)
21
-print(data)
22
-# print_2d_data(data, dataset_name=dataset_name +
23
-#              "_brutes", stop=False, save=save)
24
-
25
-print("-----------------------------------------------------------")
26
-print("     Mise à l'échelle")
27
-data_scaled = scale_data(data)
28
-# print_2d_data(data_scaled, dataset_name=dataset_name +
29
-#              "_scaled", stop=False, save=save)
30
-
31
-print("-----------------------------------------------------------")
32
-print("     Calcul du voisinage")
33
-n = 5
34
-neighbors = NearestNeighbors(n_neighbors=n)
35
-neighbors.fit(data_scaled)
36
-distances, indices = neighbors.kneighbors(data_scaled)
37
-distances = list(map(lambda x: sum(x[1:n-1])/(len(x)-1), distances))
38
-distances = np.sort(distances, axis=0)
39
-print_1d_data(distances, range(1, len(distances)+1), x_name="distance_moyenne",
40
-              y_name="nombre_de_points", stop=False, save=save)

tp6-preprocessing → tp6-preprocessing.py View File


Loading…
Cancel
Save