Customization options for asset class notebooks

You can customize some aspects of the Maximo Health asset class notebooks, such as defining custom asset classes or creating a new score type for the model to determine.

Note: Starting in Maximo Application Suite 8.11, IBM® Maximo Health and Predict - Utilities is no longer available. All the models of Maximo Health and Predict - Utilities are included in the IBM Maximo Health 8.9. To customize the Maximo Health models in the notebook, you must install and configure the IBM Watson® Studio. For more information, see Installing Watson™ Studio and Configuring notebook access.

Before you begin, review Configuration files and Asset class notebooks. The asset class notebooks are used to calculate scores or complete dissolved gas analysis (DGA). The default notebooks are used to generate predictions or to detect anomalies.

Calculating custom scores

You can customize how health, risk, criticality, end of life, effective age, and dissolved gas analysis (DGA) are calculated in the notebooks. To customize a score calculation in a notebook, complete the following steps:
  1. In the Watson Studio project that contains the Maximo Health notebooks, add a python function code to the notebook that calculates the score.
  2. Save the notebook to a Watson Studio version. You might also need to create a job from the notebook.
  3. Update the .cfg file to implement the new calculation.
  4. Upload the .cfg file to Watson Studio.
  5. In Maximo Health, create a scoring group that is connected to the notebook.

Creating a custom asset class notebook

You can create a custom asset class notebook to support unique asset classes. To create a custom asset class notebook, complete the following steps:
  1. In the Watson Studio project that contains the Maximo Health notebooks, create a new notebook by duplicating an existing notebook.
    1. Duplicate the .cfg file and rename the file.
    2. In the new .cfg file, complete the following steps:
      1. Add or edit the contributors.
      2. Update the score dependencies.
      3. To use the notebook for end of life scoring, in the End of life section, update the default curve.
      4. In the Common section, update the name, notebook, and job value to the name of the new .cfg file.
    3. Duplicate the .ipynb file and rename the file.
    4. In the new .ipynb file, complete the following steps:
      1. Update all instances of the .cfg file to the file that you created in step 1.
      2. Update the calculation for any scores.
    5. Click File > Save and File > Save version to save a new version of the notebook in Watson Studio.
    6. Create a Watson Studio job for the notebook.
      Note: The name of the job must be consistent with the job name set in the cfg file.
    7. In Maximo Health, create a scoring group that is connected to the notebook.

Adding a customized score to the model configuration file and notebook

  1. On the Scoring and DGA settings page, you can create a score by providing the following values:
    1. Score name
    2. Score value range
    3. Score value direction
    Note: For more information, see Creating custom scores.
  2. Add the score and any contributors to the model configuration file.
    Note: In the Scoretype field, use the score type ID that was generated in step 1.
    1. In defaultsetup.components, add the following text:
      "CONTRIBUTOR", "Wear", "Wear", "centigrade", "Customized meter reading of wear", "Condition meter=M-WEAR"
      "SCORE", "Health", "Health Weighted",, "Weighted health calculation",
      "SCORE", "Effective age", "Effective Age",, "Effective Age of the asset", "Mean life=30"
      "SCORE", "End of life", "End of Life",, "End of life of the asset",
      "SCORE", "Criticality", "Criticality",, "Criticality of the asset",
      "SCORE", "Risk", "Risk",, "Risk of the asset",
      "SCORE", "NewScore_1", "NewScore_1",, "NewScore_1 of asset",
    2. In defaultsetup.dependencies, add the following text:
      "NewScore_1", "Wear", "WEAR", ""
      "NewScore_1", "Health", "HEALTH", ""
      Add a contributor.
      [WEAR]
      type = CONTRIBUTOR
      desc = Customized meter of wear
      impl = wear_meter_reading
      roles = WEAR
      unit = centigrade
      # parameter.<id>.<item>
      parameter.wear.name = wear meter
      parameter.wear.type = string
      parameter.wear.format = meter
      parameter.wear.desc = Meter to measure wear value
      parameter.wear.default = M-WEAR
      Add a score.
      [NewScore_1]
      type = SCORE
      scoretype = 1009
      desc = Calculate NewScore_1
      impl = newscore_1_calc_func
      calctype = NONE
      roles = HEALTH, WEAR
  3. Add the Python functions in the notebook to calculate the score.
    The score is shifted and rescaled to a new value in target range.
    @health.maximo_function
    def newscore_1_calc_func(context,target=None):
        import pandas as pd
        import numpy as np
        from decimal import Decimal
        wear = context.get_contributor_value('WEAR')
        health = context.get_contributor_value('HEALTH')
        health_wear_df = pd.concat([health.rename('health'), wear.rename('wear')], axis=1)
        health_wear_df.dropna(inplace=True)
    
        def normalize_new_score(val):
            ##The scoretype is the scoretype id on UI once you have new scoretype created. 
            ##It must be consistent with the scoretype value of this customized score in model config file.
            scoretype=context.component.extfunction.scoretype
            scoretype_val_range=context.get_scoretype_val_range()
            if scoretype_val_range.get(scoretype,None) is not None:
                if scoretype_val_range[scoretype]['lowerneedsattention']:
                    left_boundary = scoretype_val_range[scoretype]['lower']
                    right_boundary = scoretype_val_range[scoretype]['upper']
                else:
                    left_boundary = scoretype_val_range[scoretype]['upper']
                    right_boundary = scoretype_val_range[scoretype]['lower']
    
                ##The best_score and worst_score could be modified according to your score business definition.
                best_score = 100
                worst_score = 0
                normalized_score = left_boundary + ((float(val) - worst_score)/(best_score - worst_score))*(right_boundary - left_boundary)
                return normalized_score
            else:
                return val
    
        def cal_new_score(health,wear):
            value = np.sqrt(health * wear)
            normalized_value = normalize_new_score(value)
            return int(float(Decimal(normalized_value).quantize(Decimal("0.0"), rounding = "ROUND_HALF_UP")) + 0.5 )
        new_score_series = health_wear_df.apply(lambda x: cal_new_score(x['health'],x['wear']), axis=1)
        return new_score_series
    Note: You can refer to IBM-customized-score-sample-6.0.0.ipynb for more details.