parameters: (self, disk_days: Sequence[DevSmartT])
return_statement: return "Good"
docstring: Predict using given 6-days disk S.M.A.R.T. attributes.
  
          Args:
              disk_days: A list struct comprises 6 dictionaries. These
                         dictionaries store 'consecutive' days of disk SMART
                         attributes.
          Returns:
              A string indicates prediction result. One of following four strings
              will be returned according to disk failure status:
              (1) Good : Disk is health
              (2) Warning : Disk has some symptoms but may not fail immediately
              (3) Bad : Disk is in danger and data backup is highly recommended
              (4) Unknown : Not enough data for prediction.
  
          Raises:
              Pickle exceptions
docstring_summary: Predict using given 6-days disk S.M.A.R.T. attributes.
docstring_tokens: Predict using given 6 - days disk S . M . A . R . T . attributes .
function: def predict(self, disk_days: Sequence[DevSmartT]) -> str:
          """
          Predict using given 6-days disk S.M.A.R.T. attributes.
  
          Args:
              disk_days: A list struct comprises 6 dictionaries. These
                         dictionaries store 'consecutive' days of disk SMART
                         attributes.
          Returns:
              A string indicates prediction result. One of following four strings
              will be returned according to disk failure status:
              (1) Good : Disk is health
              (2) Warning : Disk has some symptoms but may not fail immediately
              (3) Bad : Disk is in danger and data backup is highly recommended
              (4) Unknown : Not enough data for prediction.
  
          Raises:
              Pickle exceptions
          """
  
          all_pred = []
  
          proc_disk_days = self.__preprocess(disk_days)
          attr_list, diff_data = PSDiskFailurePredictor.__get_diff_attrs(proc_disk_days)
          modellist = self.__get_best_models(attr_list)
          if modellist is None:
              return "Unknown"
  
          for modelpath in modellist:
              model_attrlist = modellist[modelpath]
              ordered_data = PSDiskFailurePredictor.__get_ordered_attrs(
                  diff_data, model_attrlist
              )
  
              try:
                  with open(modelpath, "rb") as f_model:
                      clf = pickle.load(f_model)
  
              except UnicodeDecodeError:
                  # Compatibility for python3
                  with open(modelpath, "rb") as f_model:
                      clf = pickle.load(f_model, encoding="latin1")
  
              pred = clf.predict(ordered_data)
  
              all_pred.append(1 if any(pred) else 0)
  
          score = 2 ** sum(all_pred) - len(modellist)
          if score > 10:
              return "Bad"
          if score > 4:
              return "Warning"
          return "Good"
function_tokens: def predict ( self , disk_days : Sequence [ DevSmartT ] ) -> str : all_pred = [ ] proc_disk_days = self . __preprocess ( disk_days ) attr_list , diff_data = PSDiskFailurePredictor . __get_diff_attrs ( proc_disk_days ) modellist = self . __get_best_models ( attr_list ) if modellist is None : return "Unknown" for modelpath in modellist : model_attrlist = modellist [ modelpath ] ordered_data = PSDiskFailurePredictor . __get_ordered_attrs ( diff_data , model_attrlist ) try : with open ( modelpath , "rb" ) as f_model : clf = pickle . load ( f_model ) except UnicodeDecodeError : # Compatibility for python3 with open ( modelpath , "rb" ) as f_model : clf = pickle . load ( f_model , encoding = "latin1" ) pred = clf . predict ( ordered_data ) all_pred . append ( 1 if any ( pred ) else 0 ) score = 2 ** sum ( all_pred ) - len ( modellist ) if score > 10 : return "Bad" if score > 4 : return "Warning" return "Good"