<?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: MLFlow is throwing error for the shape of input in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6469#M310</link>
    <description>&lt;P&gt;please print actual shape of your dataframe before passing it to the .predict function, the list you have provided , I have created a code from that its working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are not showing the actual shape of dataframe, there is problem with the shape of the data that you are passing.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2023 10:40:36 GMT</pubDate>
    <dc:creator>Tayyab_Vohra</dc:creator>
    <dc:date>2023-04-06T10:40:36Z</dc:date>
    <item>
      <title>MLFlow is throwing error for the shape of input</title>
      <link>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6463#M304</link>
      <description>&lt;P&gt;I am running the code for prediction which will take the model from mlflow deployment. Code I have copied from the example given by mlflow experiment tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import mlflow
logged_model = 'runs:/id/model'
&amp;nbsp;
# Load model as a PyFuncModel.
loaded_model = mlflow.pyfunc.load_model(logged_model)
&amp;nbsp;
# Predict on a Pandas DataFrame.
import pandas as pd
loaded_model.predict(pd.DataFrame(data))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here I am getting the error on this line&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loaded_model.predict(pd.DataFrame(data))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MlflowException: The input pandas data frame column 'None' contains scalar values, which requires the shape to be (-1,), but got tensor spec shape of (-1, "Some big integer").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me how to resolve this error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 08:13:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6463#M304</guid>
      <dc:creator>DebK</dc:creator>
      <dc:date>2023-04-04T08:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow is throwing error for the shape of input</title>
      <link>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6464#M305</link>
      <description>&lt;P&gt;You can try this out, I don't know the shape of the dataframe it would be helpful if you would also print the shape of the dataframe , based on my assumption and the input you provided try this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import mlflow
import pandas as pd
&amp;nbsp;
# Load model as a PyFuncModel.
logged_model = 'runs:/id/model'
loaded_model = mlflow.pyfunc.load_model(logged_model)
&amp;nbsp;
# Create a list from the pandas DataFrame
data_list = data.values.tolist()
&amp;nbsp;
# Predict using the loaded model
predictions = loaded_model.predict(data_list)
&amp;nbsp;
# Print the predictions
print(predictions)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 18:49:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6464#M305</guid>
      <dc:creator>Tayyab_Vohra</dc:creator>
      <dc:date>2023-04-04T18:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow is throwing error for the shape of input</title>
      <link>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6465#M306</link>
      <description>&lt;P&gt;Hi @Koushik Deb​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting your question in our community! We are happy to assist you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 06:24:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6465#M306</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-05T06:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow is throwing error for the shape of input</title>
      <link>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6466#M307</link>
      <description>&lt;P&gt;I have tried this one.&lt;/P&gt;&lt;P&gt;I am providing data as a list of single element.&lt;/P&gt;&lt;P&gt;data = ["visit &lt;A href="https://community.databricks.com/www.bet365.com" target="test_blank"&gt;www.bet365.com&lt;/A&gt; for a free trial"]&lt;/P&gt;&lt;P&gt;Tried with &lt;/P&gt;&lt;P&gt;predictions = loaded_model.predict(data)&lt;/P&gt;&lt;P&gt;and &lt;/P&gt;&lt;P&gt;predictions = loaded_model.predict(pd.DataFrame(data))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 09:13:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6466#M307</guid>
      <dc:creator>DebK</dc:creator>
      <dc:date>2023-04-06T09:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow is throwing error for the shape of input</title>
      <link>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6467#M308</link>
      <description>&lt;P&gt;Hi @Koushik Deb​&amp;nbsp; try this your problem will be resolve now. if it works don't forget to accept and upvote the answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import mlflow
&amp;nbsp;
import pandas as pd
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
# Load model as a PyFuncModel.
&amp;nbsp;
logged_model = 'runs:/id/model'
&amp;nbsp;
loaded_model = mlflow.pyfunc.load_model(logged_model)
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
# Create a dataframe with a single column
&amp;nbsp;
data = pd.DataFrame({'text': ["visit &lt;A href="https://community.databricks.com/www.bet365.com" target="test_blank"&gt;www.bet365.com&lt;/A&gt; for a free trial"]})
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
# Call predict method with the dataframe
&amp;nbsp;
predictions = loaded_model.predict(data)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 10:05:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6467#M308</guid>
      <dc:creator>Tayyab_Vohra</dc:creator>
      <dc:date>2023-04-06T10:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow is throwing error for the shape of input</title>
      <link>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6468#M309</link>
      <description>&lt;P&gt;After executing the given code by you, I have got this error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MlflowException: The input pandas dataframe column 'None' contains scalar values, which requires the shape to be (-1,), but got tensor spec shape of (-1, 14654).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you have any idea on this.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 10:15:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6468#M309</guid>
      <dc:creator>DebK</dc:creator>
      <dc:date>2023-04-06T10:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: MLFlow is throwing error for the shape of input</title>
      <link>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6469#M310</link>
      <description>&lt;P&gt;please print actual shape of your dataframe before passing it to the .predict function, the list you have provided , I have created a code from that its working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are not showing the actual shape of dataframe, there is problem with the shape of the data that you are passing.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 10:40:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/mlflow-is-throwing-error-for-the-shape-of-input/m-p/6469#M310</guid>
      <dc:creator>Tayyab_Vohra</dc:creator>
      <dc:date>2023-04-06T10:40:36Z</dc:date>
    </item>
  </channel>
</rss>

