<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get probability score for each prediction from mlflow in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35160#M25832</link>
    <description>&lt;P&gt;Hi @Kaniz Fatma​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not see the option to select "Best Answer" but feel free to do anything that you think can help this community.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syed&lt;/P&gt;</description>
    <pubDate>Tue, 08 Nov 2022 20:16:31 GMT</pubDate>
    <dc:creator>SyedGhouri</dc:creator>
    <dc:date>2022-11-08T20:16:31Z</dc:date>
    <item>
      <title>How to get probability score for each prediction from mlflow</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35152#M25824</link>
      <description>&lt;P&gt;I trained my model and was able to get the batch prediction from that model as specified below. But I want to also get the probability scores for each prediction. Do you have any idea? &lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;logged_model = path_to_model&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Load model as a PyFuncModel.&lt;/P&gt;&lt;P&gt;loaded_model = mlflow.pyfunc.load_model(logged_model)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Predict on a Pandas DataFrame.&lt;/P&gt;&lt;P&gt;import pandas as pd&lt;/P&gt;&lt;P&gt;loaded_model.predict(pd.DataFrame(data))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 13:22:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35152#M25824</guid>
      <dc:creator>Zoumana</dc:creator>
      <dc:date>2021-11-13T13:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get probability score for each prediction from mlflow</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35154#M25826</link>
      <description>&lt;P&gt;Hi Kaniz, &lt;/P&gt;&lt;P&gt;Great to meet you too!&lt;/P&gt;&lt;P&gt;Thank you for replying to my question. &lt;/P&gt;&lt;P&gt;Best! &lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 15:21:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35154#M25826</guid>
      <dc:creator>Zoumana</dc:creator>
      <dc:date>2021-11-13T15:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get probability score for each prediction from mlflow</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35156#M25828</link>
      <description>&lt;P&gt;Hi @Kaniz Fatma​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for hijacking the post. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is - if I am reading a registered model from mlflow, I can only see the option of .predict method but not .predict_proba.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do we have any straightforward solution to get the probabilities?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Syed &lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 19:35:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35156#M25828</guid>
      <dc:creator>SyedGhouri</dc:creator>
      <dc:date>2022-11-08T19:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to get probability score for each prediction from mlflow</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35158#M25830</link>
      <description>&lt;P&gt;Hi @Kaniz Fatma​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error said 'PyFuncModel' object has no attribute 'predict_proba'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As shows above, I was using the following to load the model&lt;/P&gt;&lt;P&gt;loaded_model = mlflow.pyfunc.load_model(logged_model) and got the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After going through mlflow documentation, I changed it to &lt;/P&gt;&lt;P&gt;loaded_model = mlflow.sklearn.load_model(logged_model) and it is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's all good now. Thanks for your time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 20:06:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35158#M25830</guid>
      <dc:creator>SyedGhouri</dc:creator>
      <dc:date>2022-11-08T20:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get probability score for each prediction from mlflow</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35160#M25832</link>
      <description>&lt;P&gt;Hi @Kaniz Fatma​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not see the option to select "Best Answer" but feel free to do anything that you think can help this community.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syed&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 20:16:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/35160#M25832</guid>
      <dc:creator>SyedGhouri</dc:creator>
      <dc:date>2022-11-08T20:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get probability score for each prediction from mlflow</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/39337#M26925</link>
      <description>&lt;P&gt;Now you can log the model using this parameter:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;mlflow.sklearn.log_model(
    ...,  # the usual params
    pyfunc_predict_fn="predict_proba"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;which will return probabilities for the first class apparently when using the model for inference (e.g. when loading it using mlflow.pyfunc.spark_udf() ).&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2023 08:38:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-probability-score-for-each-prediction-from-mlflow/m-p/39337#M26925</guid>
      <dc:creator>OndrejHavlicek</dc:creator>
      <dc:date>2023-08-08T08:38:41Z</dc:date>
    </item>
  </channel>
</rss>

