Classification by regression with text in input

evelyne_tran_1evelyne_tran_1 MemberPosts:9Contributor I
edited November 2018 inHelp

Hi,

I have an excel sheat with 1 column et many lines with text. I am trying to cluster my data according to text similarity.

I have already used the k-means clustering to do the exercise but I didn't get the results that I expected. I want then to try the operator "Classification by regression". Is it however possible to use this operator with text in input?

Thanks for you answer!

Answers

  • yyhuangyyhuang Administrator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:363RM Data Scientist

    Hi@evelyne_tran_1,

    Have you transform your text into word vectors? You can refer to this kb article to get started:http://community.www.kenlockard.com/t5/Text-Analytics-in-RapidMiner/Sentiment-Analysis-as-a-supervised-learning-problem/ta-p/31827

    RapidMiner offers text mining extensions and also you can use Rosette and Aylien for text analytics.

    You will need to get these text analysis extensions from RapidMiner Marketplace first.

  • evelyne_tran_1evelyne_tran_1 MemberPosts:9Contributor I

    Hi,

    Thank you for your answer.

    Yes I transformed them into vectors as you can see in the document attached. Still, I have some issue to run my process. I have the error message « Input ExampleSet does not have a label attribute ».

    Evelyne

    Process.PNG 23.9K
  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:1761年Unicorn

    You need to select a column from your data set that will be the label. Also, is the text you are loading from the Read Excel in the Text data format for RapidMiner? Usually "text" data from an Excel comes in as a Polynominal data type and must be converted to Text. Usaually with a Nominal to Text operator.

  • evelyne_tran_1evelyne_tran_1 MemberPosts:9Contributor I

    @Thomas_Ott,

    Thanks to the Configuration Wizard, I selected my column mentionning that my data are texts and the attribute is defined as label is the step 4. Plus, I used the operator "Set Role" to defined again that my column I want to cluster is considered as label.

    I tried to put the operator "Nominal to Text" but I still have the same error message...

    Best regards,

    Evelyne

  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:1761年Unicorn

    如果你设置你的标签import, then you shouldn't need a Set Role again. You wouldn't need to do a Nominal to Text too if you set that data format in the import wizard.

    That said, what is your error? Can you share a snapshot of your data and the error message? hard for me to guess here.

  • evelyne_tran_1evelyne_tran_1 MemberPosts:9Contributor I

    @Thomas_Ott,

    You will find attached to this message the sreenshot with the configuration wizard.

    The error message says in the "Validation operator" : "Missing label, Input ExampleSet does not have a label attribute".

  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:1,635Unicorn

    @evelyne_tran_1If you post the XML of your process it is easier for community members to help you troubleshoot.

    I am confused why you would be setting the text column as your label. If that is the column of text you are going to analyze, then it would NOT typically be the label. The label is what RapidMiner calls the variable you are trying to predict--for text mining it is usually some kind of sentiment output, or perhaps a numerical rating, or a topic flag, or similar. You can't have the text be both your label and also be the data you are using to predict the label after processing.

    But in any event, you may also be having a problem because you need to make sure that your Process Document operator is keeping the meta data (which includes special attributes) after processing. See the check box in the parameter window that says "add meta information" which you would need to check.

    process doc.PNG

    Brian T.
    Lindon Ventures
    Data Science Consulting from Certified RapidMiner Experts
  • evelyne_tran_1evelyne_tran_1 MemberPosts:9Contributor I

    @Telcontar120,

    The XML is attached with this message. Actually, I only have one text column. I only want to cluster this column thanks to the operator "Classification by regression". What should be my label then?

    Evelyne

  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:1761年Unicorn

    You can't have the text column you want to process as your label. You need another column to be set as the label.

  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:1,635Unicorn

    @evelyne_tran_1Or if you want to do clustering, why do you need a label at all? You could simply do one of the unsupervised clustering algorithms such as k-means that does not utilize a label. It will create clusters based on the underlying data structure of your texts. That sounds more like what you are interested in doing. Otherwise as@Thomas_Ottsays, you will need a separate label for a supervised algorithm like regression.

    Brian T.
    Lindon Ventures
    Data Science Consulting from Certified RapidMiner Experts
  • evelyne_tran_1evelyne_tran_1 MemberPosts:9Contributor I

    I have already done the clustering thanks to the k-means algorithm but I didn't get the expected results (the quality of my clusters were not good enough). I read an article about regression clustering saying that it was significantly different from the k-means algorithm and I wanted to try it for my study.

    I just added another column in my data mentionned this time that the 2nd column was my label. I thinl that I have another issue now with the "Process document" operator saying : "Process failed. java.lan.double cannot be cast to java.lang.string"

  • evelyne_tran_1evelyne_tran_1 MemberPosts:9Contributor I

    @Telcontar120,@Thomas_Ott,

    这个问题有什么建议吗?我如何处理ss only 1 column of my excel sheet but take into consideration 2 columns for the Verification/Classification by regression" operator ?

  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:1,635Unicorn

    I am not familiar with the error message you reference--can you post the xml of the process and a data sample if you would like help diagnosing the problem?

    Brian T.
    Lindon Ventures
    Data Science Consulting from Certified RapidMiner Experts
  • evelyne_tran_1evelyne_tran_1 MemberPosts:9Contributor I

    @Telcontar120,

    Thanks for the answer. You will find the XML file attached to this message. As for the data sample, I just have 1 column with text data and I added, following your advice concerning the label attribute, another column with random integer.

    XML.xml 11.5K
  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:1761年Unicorn

    So a couple of things that was hanging up your process. Since I don't have your data, I can't really explain the problem but I can make a good guess here.

    In order to do classification on text processed data, you need to have a label column. I see that you only had a text column and then added in a Risk # as the label. That's the right thing to do because without the label, the model can't figure out what to predict into what class (i.e. yes or no, 0 or 1, etc). If you want to do classificaiton using regression you'll need to convert the Risk #'s to a nominal value. In the example below I just discretized them into two bins.

    I also noticed that you're using a Data to Documents and generic Process Documents operator, it was giving some errors on the conversion part, so I swapped it out to just a Process Documents from Data operator. I also added some pruning in my example and it all works fine now.

    Your next step is to take your XLS file and connect that into the Process Documents from Data operator. You might need to bring the data with no formats (i.e. not as a label and text) and then add Nom to Text operator and Set Role operator right before you feed it into the Process Documents from Data operator.
























    <操作符= " true " class = " select_attribute激活s" compatibility="7.4.000" expanded="true" height="82" name="Select Attributes" width="90" x="179" y="136">
















































    < portSpacing端口= " sink_model”间隔= " 0 " / >





    < portSpacing端口= " sink_model”间隔= " 0 " / >








































Sign InorRegisterto comment.