Close Menu
    Trending
    • Can Machines Really Recreate “You”?
    • Meet the researcher hosting a scientific conference by and for AI
    • Current Landscape of Artificial Intelligence Threats | by Kosiyae Yussuf | CodeToDeploy : The Tech Digest | Aug, 2025
    • Data Protection vs. Data Privacy: What’s the Real Difference?
    • Elon Musk and X reach settlement with axed Twitter workers
    • Labubu Could Reach $1B in Sales, According to Pop Mart CEO
    • Unfiltered Roleplay AI Chatbots with Pictures – My Top Picks
    • Optimizing ML Costs with Azure Machine Learning | by Joshua Fox | Aug, 2025
    AIBS News
    • Home
    • Artificial Intelligence
    • Machine Learning
    • AI Technology
    • Data Science
    • More
      • Technology
      • Business
    AIBS News
    Home»Artificial Intelligence»How To Build a Benchmark for Your Models
    Artificial Intelligence

    How To Build a Benchmark for Your Models

    Team_AIBS NewsBy Team_AIBS NewsMay 15, 2025No Comments9 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    I’ve science marketing consultant for the previous three years, and I’ve had the chance to work on a number of tasks throughout varied industries. But, I seen one frequent denominator amongst many of the shoppers I labored with:

    They hardly ever have a transparent concept of the mission goal.

    This is without doubt one of the principal obstacles knowledge scientists face, particularly now that Gen AI is taking on each area.

    However let’s suppose that after some forwards and backwards, the target turns into clear. We managed to pin down a particular query to reply. For instance:

    I need to classify my prospects into two teams in response to their likelihood to churn: “excessive probability to churn” and “low probability to churn”

    Effectively, now what? Simple, let’s begin constructing some fashions!

    Incorrect!

    If having a transparent goal is uncommon, having a dependable benchmark is even rarer.

    For my part, some of the essential steps in delivering an information science mission is defining and agreeing on a set of benchmarks with the consumer.

    On this weblog put up, I’ll clarify:

    • What a benchmark is,
    • Why it is very important have a benchmark,
    • How I might construct one utilizing an instance state of affairs and
    • Some potential drawbacks to bear in mind

    What’s a benchmark?

    A benchmark is a standardized approach to consider the efficiency of a mannequin. It gives a reference level towards which new fashions will be in contrast.

    A benchmark wants two key parts to be thought-about full:

    1. A set of metrics to judge the efficiency
    2. A set of easy fashions to make use of as baselines

    The idea at its core is easy: each time I develop a brand new mannequin I evaluate it towards each earlier variations and the baseline fashions. This ensures enhancements are actual and tracked.

    It’s important to know that this baseline shouldn’t be mannequin or dataset-specific, however relatively business-case-specific. It ought to be a basic benchmark for a given enterprise case.

    If I encounter a brand new dataset, with the identical enterprise goal, this benchmark ought to be a dependable reference level.


    Why constructing a benchmark is essential

    Now that we’ve outlined what a benchmark is, let’s dive into why I imagine it’s price spending an additional mission week on the event of a powerful benchmark.

    1. With out a Benchmark you’re aiming for perfection — If you’re working with no clear reference level any outcome will lose that means. “My mannequin has a MAE of 30.000” Is that good? IDK! Perhaps with a easy imply you’ll get a MAE of 25.000. By evaluating your mannequin to a baseline, you may measure each efficiency and enchancment.
    2. Improves Speaking with Purchasers — Purchasers and enterprise groups may not instantly perceive the usual output of a mannequin. Nevertheless, by partaking them with easy baselines from the beginning, it turns into simpler to display enhancements later. In lots of circumstances benchmarks might come straight from the enterprise in numerous shapes or types.
    3. Helps in Mannequin Choice — A benchmark offers a start line to match a number of fashions pretty. With out it, you may waste time testing fashions that aren’t price contemplating.
    4. Mannequin Drift Detection and Monitoring — Fashions can degrade over time. By having a benchmark you may be capable to intercept drifts early by evaluating new mannequin outputs towards previous benchmarks and baselines.
    5. Consistency Between Totally different Datasets — Datasets evolve. By having a set set of metrics and fashions you make sure that efficiency comparisons stay legitimate over time.

    With a transparent benchmark, each step within the mannequin improvement will present speedy suggestions, making the entire course of extra intentional and data-driven.


    How I might construct a benchmark

    I hope I’ve satisfied you of the significance of getting a benchmark. Now, let’s really construct one.

    Let’s begin from the enterprise query we introduced on the very starting of this weblog put up:

    I need to classify my prospects into two teams in response to their likelihood to churn: “excessive probability to churn” and “low probability to churn”

    For simplicity, I’ll assume no further enterprise constraints, however in real-world eventualities, constraints typically exist.

    For this instance, I’m utilizing this dataset (CC0: Public Domain). The info comprises some attributes from an organization’s buyer base (e.g., age, intercourse, variety of merchandise, …) together with their churn standing.

    Now that now we have one thing to work on let’s construct the benchmark:

    1. Defining the metrics

    We’re coping with a churn use case, specifically, it is a binary classification downside. Thus the primary metrics that we might use are:

    • Precision — Share of accurately predicted churners amongst all predicted churners
    • Recall — Share of precise churners accurately recognized
    • F1 rating — Balances precision and recall
    • True Positives, False Positives, True Damaging and False Negatives

    These are a number of the “easy” metrics that could possibly be used to judge the output of a mannequin.

    Nevertheless, it’s not an exhaustive listing, commonplace metrics aren’t at all times sufficient. In lots of use circumstances, it is perhaps helpful to construct customized metrics.

    Let’s assume that in our enterprise case the prospects labeled as “excessive probability to churn” are provided a reduction. This creates:

    • A value ($250) when providing the low cost to a non-churning buyer
    • A revenue ($1000) when retaining a churning buyer

    Following on this definition we will construct a customized metric that will likely be essential in our state of affairs:

    # Defining the enterprise case-specific reference metric
    def financial_gain(y_true, y_pred):  
        loss_from_fp = np.sum(np.logical_and(y_pred == 1, y_true == 0)) * 250  
        gain_from_tp = np.sum(np.logical_and(y_pred == 1, y_true == 1)) * 1000  
        return gain_from_tp - loss_from_fp

    When you’re constructing business-driven metrics these are often probably the most related. Such metrics might take any form or type: Monetary objectives, minimal necessities, share of protection and extra.

    2. Defining the benchmarks

    Now that we’ve outlined our metrics, we will outline a set of baseline fashions for use as a reference.

    On this part, it is best to outline a listing of simple-to-implement mannequin of their easiest doable setup. There isn’t any motive at this state to spend time and sources on the optimization of those fashions, my mindset is:

    If I had quarter-hour, how would I implement this mannequin?

    In later phases of the mannequin, you may add mode baseline fashions because the mission proceeds.

    On this case, I’ll use the next fashions:

    • Random Mannequin — Assigns labels randomly
    • Majority Mannequin — All the time predicts probably the most frequent class
    • Easy XGB
    • Easy KNN
    import numpy as np  
    import xgboost as xgb  
    from sklearn.neighbors import KNeighborsClassifier  
      
    class BinaryMean():  
        @staticmethod  
        def run_benchmark(df_train, df_test):  
            np.random.seed(21)  
            return np.random.alternative(a=[1, 0], dimension=len(df_test), p=[df_train['y'].imply(), 1 - df_train['y'].imply()])  
          
    class SimpleXbg():  
        @staticmethod  
        def run_benchmark(df_train, df_test):  
            mannequin = xgb.XGBClassifier()  
            mannequin.match(df_train.select_dtypes(embody=np.quantity).drop(columns='y'), df_train['y'])  
            return mannequin.predict(df_test.select_dtypes(embody=np.quantity).drop(columns='y'))  
          
    class MajorityClass():  
        @staticmethod  
        def run_benchmark(df_train, df_test):  
            majority_class = df_train['y'].mode()[0]  
            return np.full(len(df_test), majority_class)  
      
    class SimpleKNN():  
        @staticmethod  
        def run_benchmark(df_train, df_test):  
            mannequin = KNeighborsClassifier()  
            mannequin.match(df_train.select_dtypes(embody=np.quantity).drop(columns='y'), df_train['y'])  
            return mannequin.predict(df_test.select_dtypes(embody=np.quantity).drop(columns='y'))

    Once more, as within the case of the metrics, we will construct customized benchmarks.

    Let’s assume that in our enterprise case the the advertising workforce contacts each consumer who’s:

    • Over 50 y/o and
    • That’s not energetic anymore

    Following this rule we will construct this mannequin:

    # Defining the enterprise case-specific benchmark
    class BusinessBenchmark():  
        @staticmethod  
        def run_benchmark(df_train, df_test):  
            df = df_test.copy()  
            df.loc[:,'y_hat'] = 0  
            df.loc[(df['IsActiveMember'] == 0) & (df['Age'] >= 50), 'y_hat'] = 1  
            return df['y_hat']

    Operating the benchmark

    To run the benchmark I’ll use the next class. The entry level is the strategy compare_with_benchmark() that, given a prediction, runs all of the fashions and calculates all of the metrics.

    import numpy as np  
      
    class ChurnBinaryBenchmark():  
        def __init__(        
    	    self,  
            metrics = [],  
            benchmark_models = [],        
            ):  
            self.metrics = metrics  
            self.benchmark_models = benchmark_models  
      
        def compare_pred_with_benchmark(        
    	    self,  
            df_train,  
            df_test,  
            my_predictions,    
            ):  
           
            output_metrics = {  
                'Prediction': self._calculate_metrics(df_test['y'], my_predictions)  
            }  
            dct_benchmarks = {}  
      
            for mannequin in self.benchmark_models:  
                dct_benchmarks[model.__name__] = mannequin.run_benchmark(df_train = df_train, df_test = df_test)  
                output_metrics[f'Benchmark - {model.__name__}'] = self._calculate_metrics(df_test['y'], dct_benchmarks[model.__name__])  
      
            return output_metrics  
          
        def _calculate_metrics(self, y_true, y_pred):  
            return {getattr(func, '__name__', 'Unknown') : func(y_true = y_true, y_pred = y_pred) for func in self.metrics}

    Now all we’d like is a prediction. For this instance, I made a rapid function engineering and a few hyperparameter tuning.

    The final step is simply to run the benchmark:

    binary_benchmark = ChurnBinaryBenchmark(  
        metrics=[f1_score, precision_score, recall_score, tp, tn, fp, fn, financial_gain],  
        benchmark_models=[BinaryMean, SimpleXbg, MajorityClass, SimpleKNN, BusinessBenchmark]  
        )  
      
    res = binary_benchmark.compare_pred_with_benchmark(  
        df_train=df_train,  
        df_test=df_test,  
        my_predictions=preds,  
    )  
      
    pd.DataFrame(res)
    Benchmark metrics comparability | Picture by Writer

    This generates a comparability desk of all fashions throughout all metrics. Utilizing this desk, it’s doable to attract concrete conclusions on the mannequin’s predictions and make knowledgeable choices on the next steps of the method.


    Some drawbacks

    As we’ve seen there are many the explanation why it’s helpful to have a benchmark. Nevertheless, though benchmarks are extremely helpful, there are some pitfalls to be careful for:

    1. Non-Informative Benchmark — When the metrics or fashions are poorly outlined the marginal impression of getting a benchmark decreases. All the time outline significant baselines.
    2. Misinterpretation by Stakeholders — Communication with the consumer is important, it is very important state clearly what the metrics are measuring. One of the best mannequin may not be the most effective on all of the outlined metrics.
    3. Overfitting to the Benchmark — You may find yourself attempting to create options which are too particular, which may beat the benchmark, however don’t generalize properly in prediction. Don’t give attention to beating the benchmark, however on creating the most effective answer doable to the issue.
    4. Change of Goal — Aims outlined may change, resulting from miscommunication or adjustments in plans. Preserve your benchmark versatile so it might probably adapt when wanted.

    Closing ideas

    Benchmarks present readability, guarantee enhancements are measurable, and create a shared reference level between knowledge scientists and shoppers. They assist keep away from the lure of assuming a mannequin is performing properly with out proof and make sure that each iteration brings actual worth.

    Additionally they act as a communication software, making it simpler to clarify progress to shoppers. As an alternative of simply presenting numbers, you may present clear comparisons that spotlight enhancements.

    Here you can find a notebook with a full implementation from this blog post.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleThe USB-C of AI: How the Model Context Protocol is Changing the Game | by Atta Ullah | May, 2025
    Next Article Coinbase CEO Says Company Won’t Pay Hackers’ Ransom
    Team_AIBS News
    • Website

    Related Posts

    Artificial Intelligence

    Can Machines Really Recreate “You”?

    August 22, 2025
    Artificial Intelligence

    Unfiltered Roleplay AI Chatbots with Pictures – My Top Picks

    August 22, 2025
    Artificial Intelligence

    Roleplay AI Chatbot Apps with the Best Memory: Tested

    August 22, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Can Machines Really Recreate “You”?

    August 22, 2025

    I Tried Buying a Car Through Amazon: Here Are the Pros, Cons

    December 10, 2024

    Amazon and eBay to pay ‘fair share’ for e-waste recycling

    December 10, 2024

    Artificial Intelligence Concerns & Predictions For 2025

    December 10, 2024

    Barbara Corcoran: Entrepreneurs Must ‘Embrace Change’

    December 10, 2024
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    Most Popular

    A Love Letter to the Most Underrated Skill in AI: Naming Your Variables | by Rajkiran | Jul, 2025

    July 9, 2025

    How a Traumatic Accident Led to an 8-Figure Business

    April 22, 2025

    Powering the food industry with AI

    March 19, 2025
    Our Picks

    Can Machines Really Recreate “You”?

    August 22, 2025

    Meet the researcher hosting a scientific conference by and for AI

    August 22, 2025

    Current Landscape of Artificial Intelligence Threats | by Kosiyae Yussuf | CodeToDeploy : The Tech Digest | Aug, 2025

    August 22, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2024 Aibsnews.comAll Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.