Machine Learning

Making Problems of Multiple Objectives for Feeding Services

In the data science, it is unusual to deal with problems for competitive purposes. Whether designing products, algorithms An snnning or poor performing portfolios, we often need to measure several metrics for a very good result. Sometimes, raising certain metrics comes from the disposal of another, which makes it difficult to have a full-prepared solution.

While several remedies are there to solve many more money problems, I have found a desire to be good and easy to explain non-technical audience. What makes them have an interesting option to consider. Wish functions will include several metrics in familiar points, allowing complete performance.

In this article, we will examine:

  • The basis of the matters of the desire to wish
  • How to Use these functions to Python
  • How can you make a variety of intent about desiring activities
  • Visualization in interpretation and description of the results

Finding these ideas on the real example, we will introduce the desire to make your doy baking money: Toy of toy and fewer parameters, and competitive quality goals that will allow us to evaluate a number of decisions.

At the end of this article, you will have a new powerful tool in the Internet Science Toolkit for more purposeful use in all many domains, and the fully functional code available here in GitTub.

What are jobs to die?

The desire to formally began by Harrington (1965) and later expanded by Derringer and Suich (1980). The idea is:

  • Convert each response to a working mark between 0 (completely unacceptable) and 1 (due value)
  • Combine all scores in one metric to expand

Let us consider the types of desired works and be able to unite every scorage.

Different types of desire

There are three different duties to come true, that would allow to manage many situations.

  • Little-it's better: Used when decrease feedback is desirable
def desirability_smaller_is_better(x: float, x_min: float, x_max: float) -> float:
    """Calculate desirability function value where smaller values are better.

    Args:
        x: Input parameter value
        x_min: Minimum acceptable value
        x_max: Maximum acceptable value

    Returns:
        Desirability score between 0 and 1
    """
    if x <= x_min:
        return 1.0
    elif x >= x_max:
        return 0.0
    else:
        return (x_max - x) / (x_max - x_min)
  • More-better: Used when expanding feedback is desirable
def desirability_larger_is_better(x: float, x_min: float, x_max: float) -> float:
    """Calculate desirability function value where larger values are better.

    Args:
        x: Input parameter value
        x_min: Minimum acceptable value
        x_max: Maximum acceptable value

    Returns:
        Desirability score between 0 and 1
    """
    if x <= x_min:
        return 0.0
    elif x >= x_max:
        return 1.0
    else:
        return (x - x_min) / (x_max - x_min)
  • Target-is-best: Used when a certain amount of target is correct
def desirability_target_is_best(x: float, x_min: float, x_target: float, x_max: float) -> float:
    """Calculate two-sided desirability function value with target value.

    Args:
        x: Input parameter value
        x_min: Minimum acceptable value
        x_target: Target (optimal) value
        x_max: Maximum acceptable value

    Returns:
        Desirability score between 0 and 1
    """
    if x_min <= x <= x_target:
        return (x - x_min) / (x_target - x_min)
    elif x_target < x <= x_max:
        return (x_max - x) / (x_max - x_target)
    else:
        return 0.0

Every time the installation parameter may be placed on one of these three wishes, before combining them into a single desire.

Combining Thorough Scores

When individual metric converts to wishing scores, they need to be compiled into a perfect object. The most common way is a geometric drama:

When dme Individuals of individual wishes and Wme They are metals that show the importance of each metriri.

Geometric Information has an important place: If any single wish is 0 (ie fully accepted), the full demand is 0, regardless of the amounts. This emphasizes that all needs should meet to some extent.

def overall_desirability(desirabilities, weights=None):
    """Compute overall desirability using geometric mean
    
    Parameters:
    -----------
    desirabilities : list
        Individual desirability scores
    weights : list
        Weights for each desirability
        
    Returns:
    --------
    float
        Overall desirability score
    """
    if weights is None:
        weights = [1] * len(desirabilities)
        
    # Convert to numpy arrays
    d = np.array(desirabilities)
    w = np.array(weights)
    
    # Calculate geometric mean
    return np.prod(d ** w) ** (1 / np.sum(w))

The instruments are hyperpaseters that give the final outcome and provide a custom performance.

An effective example of using: bread baking

To show desiring activities in action, let's use them in toy trouble: the problem of applying bread.

Parameters and quality metrics

Let's play the following parameters:

  1. Time for an Early (30-180 minutes)
  2. The temperature of the fuel (20-30 ° C)
  3. Hydration level (60-85%)
  4. Dismissal Time (0-20 minutes)
  5. Baking heat (180-250 ° C)

And let's try to increase these metrics:

  1. Status: The texture of bread
  2. Flavor profile: The taste of bread
  3. To be on the porch: Use of the whole criteria

Of course, each metric depends on more than one parameter. So here is one of the most critical steps: Map parameters in the metric metrics.

With each quality metric, we need to explain how the parameters influence:

def compute_flavor_profile(params: List[float]) -> float:
    """Compute flavor profile score based on input parameters.

    Args:
        params: List of parameter values [fermentation_time, ferment_temp, hydration,
               kneading_time, baking_temp]

    Returns:
        Weighted flavor profile score between 0 and 1
    """
    # Flavor mainly affected by fermentation parameters
    fermentation_d = desirability_larger_is_better(params[0], 30, 180)
    ferment_temp_d = desirability_target_is_best(params[1], 20, 24, 28)
    hydration_d = desirability_target_is_best(params[2], 65, 75, 85)

    # Baking temperature has minimal effect on flavor
    weights = [0.5, 0.3, 0.2]
    return np.average([fermentation_d, ferment_temp_d, hydration_d],
                      weights=weights)

Here, for example, the taste is the following:

  • An eraduation period, desirably less than 30 minutes and maximum desires above 180 minutes
  • Fermentation temperatures, having higher maximum higher intensity in 24 degrees Celsius
  • Hydration, with a high-maximum upper-maximum of 75% moisture

These mixed parameters and then weighed a limited way to return the taste of blurry. Same coalition and performed in the quality of sewing and usefulness.

Purpose

After a way of Fukuality Work, we will use complete demand as our goal work. The goal is to increase this complete detail, which means getting better satisfactory parameters for all our three needs at the same time:

def objective_function(params: List[float], weights: List[float]) -> float:
    """Compute overall desirability score based on individual quality metrics.

    Args:
        params: List of parameter values
        weights: Weights for texture, flavor and practicality scores

    Returns:
        Negative overall desirability score (for minimization)
    """
    # Compute individual desirability scores
    texture = compute_texture_quality(params)
    flavor = compute_flavor_profile(params)
    practicality = compute_practicality(params)

    # Ensure weights sum up to one
    weights = np.array(weights) / np.sum(weights)

    # Calculate overall desirability using geometric mean
    overall_d = overall_desirability([texture, flavor, practicality], weights)

    # Return negative value since we want to maximize desirability
    # but optimization functions typically minimize
    return -overall_d

After lighting individuals of individual texture, taste and functioning; Total tiredness is simply integrated with mass geometric. Finally returns the perfect correct importance, for reducing.

Effective Using With Scip

We finally used Scipimate's minimize work to find the correct parameters. As we returned the poorest importance as a function of purpose, reducing that will increase complete achievement:

def optimize(weights: list[float]) -> list[float]:
    # Define parameter bounds
    bounds = {
        'fermentation_time': (1, 24),
        'fermentation_temp': (20, 30),
        'hydration_level': (60, 85),
        'kneading_time': (0, 20),
        'baking_temp': (180, 250)
    }

    # Initial guess (middle of bounds)
    x0 = [(b[0] + b[1]) / 2 for b in bounds.values()]

    # Run optimization
    result = minimize(
        objective_function,
        x0,
        args=(weights,),
        bounds=list(bounds.values()),
        method='SLSQP'
    )

    return result.x

In this work, after describing the boundaries of each parameter, first prediction included in the center of boundaries, and then there is as input to the minimize SCIP work. The result was finally restored.

Weights are provided as optimizer installation, and it is a good way to customize the result. For example, by the main weight in operation, the repaired solution will focus on performing taste and sewing.

Let's now see the results of a few sets of weight.

Visualize

Let's see how Optimizer treats different profiles available, indicating descendance of desire, given a variety of installation.

Let us look at the results in the event of metals prefer to work well:

Parameters are prepared with metals that like to work well. Photo by author.

Especially weighed, achieved by the full demand 0.69 is a short period of time 5 minutes, because the peak value is mistreating.

Now, if we use the emphasis of texture, we have a little different results:

Parameters prepared with popular instruments. Photo by author.

In this case, the complete achievement found is 0.85, very loud. The interviewer is this time 12 minutes, as the high value contains a good texture and does not slap so much because of usefulness.

Conclusion: Applicable use of desiring activities

While focusing on the baking of bread as our example, the same method can be included in different backgrounds, such as product launches or resources in Portfolio.

Wishing functions provide a strong statistical framework for dealing with multiple energy-based use of the increase in multiple data requests. By converting the green metrics into ordinary wish scores, we can successfully merge and use different purposes.

The main benefits of this method include:

  • Medical scales that make different matches compared and easy to combine on one target
  • Flexibility to manage different types of purposes: Reduce, increase, targeted
  • A clear connection to favorites with mathematical activities

The code presented here provides the first of your assessment. Whether you are preparing for industry processes, the machine reading models, or product construction, hoping that wishing activities provide the best possible way between competitive purposes.

Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button