def write_hw_rule(self, switch_obj, sw_activity, driver_obj, driver_action,
                      disable_on_release=True, drive_now=False,
                      **driver_settings_overrides):

        driver_settings = deepcopy(driver_obj.hw_driver.driver_settings)

        driver_settings.update(driver_obj.hw_driver.merge_driver_settings(
            **driver_settings_overrides))

        self.log.debug("Setting HW Rule. Switch: %s, Switch_action: %s, Driver:"
                      " %s, Driver settings: %s", switch_obj.name, sw_activity,
                      driver_obj.name, driver_settings)

        control = 0x01  # Driver enabled
        if drive_now:
            control += 0x08

        if sw_activity == 0:
            control += 0x10

        control = Util.int_to_hex_string(int(control))

        # todo need to implement disable_on_release

        if driver_action == 'pulse':
            mode = '10'                               # Mode 10 settings
            param1 = driver_settings['pulse_ms']      # initial pulse ms
            param2 = driver_settings['pwm1']          # intial pwm
            param3 = '00'                             # pulse 2 time
            param4 = '00'                             # pulse 2 pwm
            param5 = driver_settings['recycle_ms']    # recycle ms

        elif driver_action == 'hold':
            mode = '18'                               # Mode 18 settings
            param1 = driver_settings['pulse_ms']      # intiial pulse ms
            param2 = driver_settings['pwm1']          # intial pwm
            param3 = driver_settings['pwm2']          # hold pwm
            param4 = driver_settings['recycle_ms']    # recycle ms
            param5 = '00'                             # not used with Mode 18

        elif driver_action == 'timed_hold':

            # fast hold time is ms*100
            hold_value = driver_settings['activation_time']

            mode = '70'                               # Mode 70 settings
            param1 = driver_settings['pulse_ms']      # intiial pulse ms
            param2 = driver_settings['pwm1']          # intial pwm
            param3 = hold_value                       # hold time
            param4 = driver_settings['pwm2']          # hold pwm
            param5 = driver_settings['recycle_ms']    # recycle ms

        else:
            raise ValueError("Invalid driver action: '%s'. Expected 'hold', "
                             "'timed_hold', or 'pulse'" % (driver_action))

        self.hw_rules[driver_obj] = {'mode': mode,
                               'param1': param1,
                               'param2': param2,
                               'param3': param3,
                               'param4': param4,
                               'param5': param5,
                               'switch': switch_obj.number}

        cmd = (driver_settings['config_cmd'] +
               driver_obj.number[0] + ',' +
               control  + ',' +
               switch_obj.number[0] + ',' +
               mode + ',' +
               param1 + ',' +
               param2 + ',' +
               param3 + ',' +
               param4 + ',' +
               param5)

        driver_obj.autofire = cmd
        self.log.debug("Writing hardware rule: %s", cmd)

        self.net_connection.send(cmd)
Compute the hidden layer activation probabilities, P(h=1|v=X).
dataset/ETHPy150Open missionpinball/mpf/mpf/platform/fast.py/HardwarePlatform.write_hw_rule--crossover with--dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/neural_network/rbm.py/BernoulliRBM.transform