11from sklearn .ensemble import RandomForestClassifier as _RandomForestClassifier
22
33from DashAI .back .core .schema_fields import BaseSchema , optimizer_int_field , schema_field
4+ from DashAI .back .core .utils import MultilingualString
45from DashAI .back .models .scikit_learn .sklearn_like_classifier import (
56 SklearnLikeClassifier ,
67)
@@ -21,8 +22,17 @@ class RandomForestClassifierSchema(BaseSchema):
2122 "lower_bound" : 50 ,
2223 "upper_bound" : 200 ,
2324 },
24- description = "The 'n_estimators' parameter corresponds to the number of "
25- "decision trees. It must be an integer greater than or equal to 1." ,
25+ description = MultilingualString (
26+ en = (
27+ "The 'n_estimators' parameter corresponds to the number of decision "
28+ "trees. It must be an integer greater than or equal to 1."
29+ ),
30+ es = (
31+ "El parámetro 'n_estimators' corresponde al número de árboles de "
32+ "decisión. Debe ser un entero mayor o igual a 1."
33+ ),
34+ ),
35+ alias = MultilingualString (en = "N estimators" , es = "N estimadores" ),
2636 ) # type: ignore
2737 max_depth : schema_field (
2838 optimizer_int_field (ge = 1 ),
@@ -32,8 +42,17 @@ class RandomForestClassifierSchema(BaseSchema):
3242 "lower_bound" : 2 ,
3343 "upper_bound" : 10 ,
3444 },
35- description = "The 'max_depth' parameter corresponds to the maximum depth of "
36- "the tree. It must be an integer greater than or equal to 1." ,
45+ description = MultilingualString (
46+ en = (
47+ "The parameter corresponds to the maximum depth of the "
48+ "tree. It must be an integer greater than or equal to 1."
49+ ),
50+ es = (
51+ "El parámetro corresponde a la profundidad máxima del "
52+ "árbol. Debe ser un entero mayor o igual a 1."
53+ ),
54+ ),
55+ alias = MultilingualString (en = "Max depth" , es = "Profundidad máxima" ),
3756 ) # type: ignore
3857 min_samples_split : schema_field (
3958 optimizer_int_field (ge = 2 ),
@@ -43,9 +62,21 @@ class RandomForestClassifierSchema(BaseSchema):
4362 "lower_bound" : 2 ,
4463 "upper_bound" : 10 ,
4564 },
46- description = "The 'min_samples_split' parameter is the minimum number of "
47- "samples required to split an internal node. It must be a number greater than "
48- "or equal to 2." ,
65+ description = MultilingualString (
66+ en = (
67+ "This parameter sets the minimum number of samples "
68+ "required to split an internal node. It must be a number greater than "
69+ "or equal to 2."
70+ ),
71+ es = (
72+ "Este parámetro establece el número mínimo de muestras "
73+ "requeridas para dividir un nodo interno. Debe ser un número mayor o "
74+ "igual a 2."
75+ ),
76+ ),
77+ alias = MultilingualString (
78+ en = "Min samples split" , es = "Mínimas muestras de división"
79+ ),
4980 ) # type: ignore
5081 min_samples_leaf : schema_field (
5182 optimizer_int_field (ge = 1 ),
@@ -55,9 +86,21 @@ class RandomForestClassifierSchema(BaseSchema):
5586 "lower_bound" : 1 ,
5687 "upper_bound" : 10 ,
5788 },
58- description = "The 'min_samples_leaf' parameter is the minimum number of "
59- "samples required to be at a leaf node. It must be a number greater than or "
60- "equal to 1." ,
89+ description = MultilingualString (
90+ en = (
91+ "This parameter sets the minimum number of samples "
92+ "required to be at a leaf node. It must be a number greater than or "
93+ "equal to 1."
94+ ),
95+ es = (
96+ "Este parámetro establece el número mínimo de muestras "
97+ "requeridas para estar en una hoja. Debe ser un número mayor o igual "
98+ "a 1."
99+ ),
100+ ),
101+ alias = MultilingualString (
102+ en = "Min samples leaf" , es = "Mínimas muestras para hoja"
103+ ),
61104 ) # type: ignore
62105 max_leaf_nodes : schema_field (
63106 optimizer_int_field (ge = 2 ),
@@ -67,14 +110,16 @@ class RandomForestClassifierSchema(BaseSchema):
67110 "lower_bound" : 2 ,
68111 "upper_bound" : 10 ,
69112 },
70- description = "The 'max_leaf_nodes' parameter must be an integer greater "
71- "than or equal to 2." ,
72- ) # type: ignore
73- random_state : schema_field (
74- optimizer_int_field (ge = 0 ),
75- placeholder = None ,
76- description = "The 'random_state' parameter must be an integer greater than "
77- "or equal to 0." ,
113+ description = MultilingualString (
114+ en = (
115+ "This parameter sets the maximum number of leaf nodes. It must be an integer greater than or "
116+ "equal to 2."
117+ ),
118+ es = (
119+ "Este parámetro establece el número máximo de nodos hoja. Debe ser un entero mayor o igual a 2."
120+ ),
121+ ),
122+ alias = MultilingualString (en = "Max leaf nodes" , es = "Máximos nodos para hoja" ),
78123 ) # type: ignore
79124 random_state : schema_field (
80125 optimizer_int_field (ge = 0 ),
@@ -84,8 +129,11 @@ class RandomForestClassifierSchema(BaseSchema):
84129 "lower_bound" : 0 ,
85130 "upper_bound" : 10 ,
86131 },
87- description = "The 'random_state' parameter must be an integer greater than "
88- "or equal to 0." ,
132+ description = MultilingualString (
133+ en = ("This parameter must be an integer greater than or " "equal to 0." ),
134+ es = ("Este parámetro debe ser un entero mayor o igual a 0." ),
135+ ),
136+ alias = MultilingualString (en = "Random State" , es = "Estado Aleatorio" ),
89137 ) # type: ignore
90138
91139
@@ -95,8 +143,17 @@ class RandomForestClassifier(
95143 """Scikit-learn's Random Forest classifier wrapper for DashAI."""
96144
97145 SCHEMA = RandomForestClassifierSchema
98- DISPLAY_NAME : str = "Random Forest"
99- DESCRIPTION : str = "An ensemble learning method using multiple decision trees."
146+ DISPLAY_NAME : str = MultilingualString (
147+ en = "Random Forest" ,
148+ es = "Bosque Aleatorio" ,
149+ )
150+ DESCRIPTION : str = MultilingualString (
151+ en = "An ensemble learning method using multiple decision trees." ,
152+ es = (
153+ "Un método de aprendizaje en conjunto que utiliza múltiples árboles de "
154+ "decisión."
155+ ),
156+ )
100157 COLOR : str = "#FF8A65"
101158 ICON : str = "Forest"
102159
0 commit comments