sarapy 1.1.5__tar.gz → 1.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {sarapy-1.1.5/sarapy.egg-info → sarapy-1.2.6}/PKG-INFO +9 -1
  2. {sarapy-1.1.5 → sarapy-1.2.6}/README.md +8 -0
  3. {sarapy-1.1.5 → sarapy-1.2.6}/pyproject.toml +1 -1
  4. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/dataProcessing/OpsProcessor.py +1 -1
  5. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/mlProcessors/PlantinClassifier.py +29 -6
  6. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/version.py +1 -1
  7. {sarapy-1.1.5 → sarapy-1.2.6/sarapy.egg-info}/PKG-INFO +9 -1
  8. {sarapy-1.1.5 → sarapy-1.2.6}/LICENCE +0 -0
  9. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/__init__.py +0 -0
  10. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/dataProcessing/GeoProcessor.py +0 -0
  11. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/dataProcessing/TLMSensorDataProcessor.py +0 -0
  12. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/dataProcessing/TimeSeriesProcessor.py +0 -0
  13. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/dataProcessing/__init__.py +0 -0
  14. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/mlProcessors/PlantinFMCreator.py +0 -0
  15. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/mlProcessors/__init__.py +0 -0
  16. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/preprocessing/DistancesImputer.py +0 -0
  17. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/preprocessing/FertilizerImputer.py +0 -0
  18. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/preprocessing/TransformInputData.py +0 -0
  19. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/preprocessing/TransformToOutputData.py +0 -0
  20. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/preprocessing/__init__.py +0 -0
  21. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/utils/__init__.py +0 -0
  22. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/utils/amg_decoder.py +0 -0
  23. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/utils/amg_ppk.py +0 -0
  24. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy/utils/getRawOperations.py +0 -0
  25. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy.egg-info/SOURCES.txt +0 -0
  26. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy.egg-info/dependency_links.txt +0 -0
  27. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy.egg-info/requires.txt +0 -0
  28. {sarapy-1.1.5 → sarapy-1.2.6}/sarapy.egg-info/top_level.txt +0 -0
  29. {sarapy-1.1.5 → sarapy-1.2.6}/setup.cfg +0 -0
  30. {sarapy-1.1.5 → sarapy-1.2.6}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sarapy
3
- Version: 1.1.5
3
+ Version: 1.2.6
4
4
  Home-page: https://github.com/lucasbaldezzari/sarapy
5
5
  Author: Lucas Baldezzari
6
6
  Author-email: Lucas Baldezzari <lmbaldezzari@gmail.com>
@@ -19,6 +19,14 @@ Requires-Dist: geopy
19
19
 
20
20
  Library for processing SARAPICO project metadata of _AMG SA_.
21
21
 
22
+ #### Version 1.2.6
23
+
24
+ - Se agrega línea dentro de clase OpsProcessor.
25
+
26
+ #### Version 1.1.6
27
+
28
+ - Se modifica PlantinClassifier para mejorar el NO conteo de plantines en OSP.
29
+
22
30
  #### Version 1.1.5
23
31
 
24
32
  - Se quita print de función update.
@@ -2,6 +2,14 @@
2
2
 
3
3
  Library for processing SARAPICO project metadata of _AMG SA_.
4
4
 
5
+ #### Version 1.2.6
6
+
7
+ - Se agrega línea dentro de clase OpsProcessor.
8
+
9
+ #### Version 1.1.6
10
+
11
+ - Se modifica PlantinClassifier para mejorar el NO conteo de plantines en OSP.
12
+
5
13
  #### Version 1.1.5
6
14
 
7
15
  - Se quita print de función update.
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "sarapy"
3
3
 
4
- version = "1.1.5"
4
+ version = "1.2.6"
5
5
  authors = [
6
6
  {name = "Lucas Baldezzari", email = "lmbaldezzari@gmail.com"},]
7
7
  maintainers = [
@@ -185,7 +185,7 @@ class OpsProcessor():
185
185
  ##clasificamos las operaciones para plantín
186
186
  operations = self.operationsDict[ID_NPDP]["sample_ops"]
187
187
  features, dst_pt, inest_pt = self.plantinFMCreator.fit_transform(operations)
188
- classified_ops = self._plantin_classifier.classify(features, **classify_kwargs)
188
+ classified_ops = self._plantin_classifier.classify(features, dst_pt, inest_pt, **classify_kwargs)
189
189
 
190
190
  ##chequeo si first_day_op_classified es True, si es así, no se considera la primera fila de las classified_ops
191
191
  if self.operationsDict[ID_NPDP]["first_day_op_classified"]:
@@ -23,14 +23,18 @@ class PlantinClassifier(BaseEstimator, TransformerMixin):
23
23
  except FileNotFoundError:
24
24
  print("El archivo no se encuentra en el directorio actual.")
25
25
 
26
- def classify(self, feature_matrix, update_samePlace:bool = True, **kwargs):
26
+ def classify(self, feature_matrix, dst_pt, inest_pt,
27
+ update_samePlace:bool = True, update_dstpt: bool = True,
28
+ umbral_proba = 0.85, **kwargs):
27
29
  """Genera la clasificación de las operaciones para plantines.
28
30
 
29
- feature_matrix: Es un array con los datos (strings) provenientes de la base de datos histórica.
31
+ - feature_matrix: Es un array con los datos (strings) provenientes de la base de datos histórica.
30
32
  La forma de newData debe ser (n,3). Las columnas de newData deben ser,
31
33
  - 1: deltaO
32
34
  - 2: ratio_dCdP
33
35
  - 3: distancias
36
+ - dst_pt: Array con las distorsiones de plantín.
37
+ - inest_pt: Array con flag de inestabilidad de plantín.
34
38
 
35
39
  kwargs: Diccionario con los argumentos necesarios para la clasificación.
36
40
 
@@ -38,11 +42,15 @@ class PlantinClassifier(BaseEstimator, TransformerMixin):
38
42
  """
39
43
 
40
44
  self.clasificaiones = self._pipeline.predict(feature_matrix)
45
+ self.probas = self._pipeline.predict_proba(feature_matrix)
41
46
 
42
47
  if update_samePlace:
43
48
  self.grouped_ops = self.groupOpsSamePlace(feature_matrix, **kwargs)
44
49
  self.clasificaiones = self.updateLabelsSamePlace(self.clasificaiones, self.grouped_ops)
45
50
 
51
+ if update_dstpt:
52
+ self.clasificaiones = self.updateLabelsFromDSTPT(self.clasificaiones, dst_pt, inest_pt, umbral_proba)
53
+
46
54
  return self.clasificaiones
47
55
 
48
56
  def groupOpsSamePlace(self, X, useRatioStats = True, std_weight=1, useDistancesStats = True,
@@ -116,6 +124,20 @@ class PlantinClassifier(BaseEstimator, TransformerMixin):
116
124
 
117
125
  return new_labels
118
126
 
127
+ def updateLabelsFromDSTPT(self, labels, dst_pt, inest_pt, umbral_proba = 0.85):
128
+ """
129
+ Función para actualizar las etiquetas de las operaciones que tengan distorsiones de plantín.
130
+ """
131
+ new_labels = labels.copy()
132
+ ##filtro si dst_pt es menor a 7 y si inest_pt es 0
133
+ new_labels[(dst_pt < 7) & (inest_pt == 0)] = 0
134
+
135
+ ##si inest_pt es y umbral_proba es menor a umbra_proba, entonces la operación es 0
136
+ new_labels[(inest_pt == 1) & (self.probas[:,1] < umbral_proba)] = 0
137
+ # new_labels[(inest_pt == 1) & (self.probas[:,1] >= umbral_proba)] = 1
138
+
139
+ return new_labels
140
+
119
141
  if __name__ == "__main__":
120
142
  import os
121
143
  import pandas as pd
@@ -128,8 +150,8 @@ if __name__ == "__main__":
128
150
  fmcreator = PlantinFMCreator.PlantinFMCreator(imputeDistances=False)
129
151
  tindata = TransformInputData.TransformInputData()
130
152
 
131
- data_path = os.path.join(os.getcwd(), "examples\\2024-09-04\\UPM011N\\data.json")
132
- historical_data_path = os.path.join(os.getcwd(), "examples\\2024-09-04\\UPM011N\\historical-data.json")
153
+ data_path = os.path.join(os.getcwd(), "examples\\2024-10-15\\UPM015N\\data.json")
154
+ historical_data_path = os.path.join(os.getcwd(), "examples\\2024-10-15\\UPM015N\\historical-data.json")
133
155
  raw_data = pd.read_json(data_path, orient="records").to_dict(orient="records")
134
156
  raw_data2 = pd.read_json(historical_data_path, orient="records").to_dict(orient="records")
135
157
 
@@ -141,5 +163,6 @@ if __name__ == "__main__":
141
163
  rf_clf_nu = PlantinClassifier.PlantinClassifier(classifier_file='modelos\\pipeline_rf.pkl') ##wu = no update
142
164
  rf_clf_wu = PlantinClassifier.PlantinClassifier(classifier_file='modelos\\pipeline_rf.pkl') ##wu = with update
143
165
 
144
- print(rf_clf_nu.classify(X, update_samePlace = False).mean())
145
- print(rf_clf_wu.classify(X, update_samePlace=True, useRatioStats=True, useDistancesStats=True).mean())
166
+ print(rf_clf_nu.classify(X, dst_pt, inest_pt, update_samePlace = False, update_dstpt=False).mean())
167
+ print(rf_clf_wu.classify(X, dst_pt, inest_pt, update_samePlace=True, update_dstpt=True,
168
+ useRatioStats=True, useDistancesStats=True,umbral_proba=0.8).mean())
@@ -1,2 +1,2 @@
1
1
  ## Version of the package
2
- __version__ = "1.1.5"
2
+ __version__ = "1.2.6"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sarapy
3
- Version: 1.1.5
3
+ Version: 1.2.6
4
4
  Home-page: https://github.com/lucasbaldezzari/sarapy
5
5
  Author: Lucas Baldezzari
6
6
  Author-email: Lucas Baldezzari <lmbaldezzari@gmail.com>
@@ -19,6 +19,14 @@ Requires-Dist: geopy
19
19
 
20
20
  Library for processing SARAPICO project metadata of _AMG SA_.
21
21
 
22
+ #### Version 1.2.6
23
+
24
+ - Se agrega línea dentro de clase OpsProcessor.
25
+
26
+ #### Version 1.1.6
27
+
28
+ - Se modifica PlantinClassifier para mejorar el NO conteo de plantines en OSP.
29
+
22
30
  #### Version 1.1.5
23
31
 
24
32
  - Se quita print de función update.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes