Parcourir la source

bugfix: 图片显示及单调性判断

yq il y a 3 mois
Parent
commit
240ba09ab7
3 fichiers modifiés avec 7 ajouts et 4 suppressions
  1. 3 2
      commom/utils.py
  2. 3 1
      feature/feature_utils.py
  3. 1 1
      model/model_lr.py

+ 3 - 2
commom/utils.py

@@ -96,14 +96,15 @@ def f_display_images_by_side(image_path_list, display, title: str = "", width: i
                              image_path_list2: Union[list, None] = None, title2: str = "", ):
     if isinstance(image_path_list, str):
         image_path_list = [image_path_list]
-    html_str = '<div style="display:flex; justify-content:space-around;">'
+    # justify-content:space-around; 会导致某些情况下图片越界
+    html_str = '<div style="display:flex;">'
     if title != "":
         html_str += '<h3>{}</h3>'.format(title)
     for image_path in image_path_list:
         html_str += f'<img src="data:image/png;base64,{_f_image_to_base64(image_path)}" style="width:{width}px;"/>'
     html_str += '</div>'
     if not (image_path_list2 is None or len(image_path_list2) == 0):
-        html_str += '<div style="display:flex; justify-content:space-around;">'
+        html_str += '<div style="display:flex;">'
         if title2 != "":
             html_str += '<h3>{}</h3>'.format(title2)
         for image_path in image_path_list2:

+ 3 - 1
feature/feature_utils.py

@@ -76,7 +76,9 @@ def f_format_bin(data_describe: pd.Series, raw_v):
 
 
 # 此函数判断list的单调性,允许至多N次符号变化
-def f_judge_monto(bd_list: list, pos_neg_cnt: int = 1) -> int:
+def f_judge_monto(bd_list: list, pos_neg_cnt: int = 1) -> bool:
+    if len(bd_list) < 2:
+        return True
     start_tr = bd_list[1] - bd_list[0]
     tmp_len = len(bd_list)
     pos_neg_flag = 0

+ 1 - 1
model/model_lr.py

@@ -23,7 +23,7 @@ class ModelLr(ModelBase):
         super().__init__(*args, **kwargs)
         # 报告模板
         self._template_path = os.path.join(dirname(dirname(realpath(__file__))), "./template/模型开发报告模板_lr.docx")
-        self.lr = LogisticRegression(penalty='l1', C=0.9, solver='saga', n_jobs=-1)
+        self.lr = LogisticRegression(C=1e12, fit_intercept=False)
 
     def get_template_path(self):
         return self._template_path