Icon

01.Deploying_​Sentiment_​Predictor - Exercise

Deploying Sentiment Predictor - Exercise

In this exercise you will move a workflow to production by deploying it to the KNIME Server.

The CSV Writer node is configured witha LOCAL mountpoint relative path.Therefore, it works locally, but fails tofind the path on the server.Change the path to workflow relativeand select the Data folder with the path../Data/sentiment_results.csvPULL FOR THE SOLUTION Session 2 - Deploy to KNIME ServerExercise 01-Deploying_Sentiment_PredictorIn this exercise you will move a workflow to production by deploying it to the KNIME Server. 1. Read tweets .Here we read tweets that were previouslycollected with the Twitter API, and a fewcolumns get renamed so that we can betterreuse shared components and workflowsegments derived from the buildingworkflow. 2. Data Manipulation/Preparation.Here we execute a captured workflow segment of thebuilding workflow that performs some datapreprocessing. The most important node in thissegment is "Strings to Document", which formatsseveral string columns into a single document thatcan be text-mined in KNIME. 3. Use Text Mining to Tag Words with Positive and NegativeMeaning based on a Dictionary.Here we execute another captured segment of the buildingworkflow -- this time, to tag words based on their sentiment. Non-tagged words get filtered out in the end. 6. Get Original Data and Joined Sentiment Predictions. Here we execute a segment of the building workflow that joins the original data with joinedpredictions, when they exist. Recall that if a tweet/document does not have any sentimentword, it will have a neutral sentiment prediction associated with it. The quality of thesepredictions can then be evaluated by using this dataset in a web application or in a webservice. Here, we send the output back for testing purposes. 5. Calculate a Sentiment Score based on the Number of Positiveand Negative Words and Classify Documents based on the Score.The sentiment score is calculated by (number of postive words -number of negative words) divided by (number of postive words +number of negative words). If the score is negative it is classifiedas negative, if the score is positive it is classified as positive, and ifit is equal to 0 it is classified as neutral. 4. Count the Number of Positive and Negative Words perDocument.Here we re-use a shared component also present in thebuilding workflow. It encapsulates the counting of sentimentwords per document, separated by class. Step 1. Deploying the workflow to KNIME Server0. Add the workflow server mountpoint following theinstructions on the slides.1. Deploy the workflow group Session 2 - Exercises to theServer, inside the workflow group yourname.yoursurname.Make sure to include Workflow_Segments, Components andData folders.3. Schedule an execution of this workflow (2 min later) andsend yourself a notification on successfull/unsuccessfulexecution.4. (Spoiler) The workflow will fail. Open the workflow job onthe server and recognize the error5. It's time to fix the bug! Edit the local copy and re-deploy.Make sure to create a snapshot when deploying the fixedcopy.6. Execute again the deployed workflow on the server andcheck the produced results. Step 2(Optional). Workflow difference1.Open the Server History of the deployed workflow2.Select the last snapshot and download it locally3.Compare the old and new version locally with the WorkflowDifference function 7. Export the predicted sentiment to csv.Here we write the table with the text and thepredicted sentiment to a csv file. Execute data preparationworkflow overextracted tweetsExecute word taggingworkflow overextracted tweetsExecute result joiningworkflow overextracted tweets andsentiment predictionsRead tweets extractedwith the Twitter APINumbers of Positive andNegative Words per Tweet Column Rename Calculate Scores Call WorkflowService Call WorkflowService Call WorkflowService CSV Reader CSV Writer The CSV Writer node is configured witha LOCAL mountpoint relative path.Therefore, it works locally, but fails tofind the path on the server.Change the path to workflow relativeand select the Data folder with the path../Data/sentiment_results.csvPULL FOR THE SOLUTION Session 2 - Deploy to KNIME ServerExercise 01-Deploying_Sentiment_PredictorIn this exercise you will move a workflow to production by deploying it to the KNIME Server. 1. Read tweets .Here we read tweets that were previouslycollected with the Twitter API, and a fewcolumns get renamed so that we can betterreuse shared components and workflowsegments derived from the buildingworkflow. 2. Data Manipulation/Preparation.Here we execute a captured workflow segment of thebuilding workflow that performs some datapreprocessing. The most important node in thissegment is "Strings to Document", which formatsseveral string columns into a single document thatcan be text-mined in KNIME. 3. Use Text Mining to Tag Words with Positive and NegativeMeaning based on a Dictionary.Here we execute another captured segment of the buildingworkflow -- this time, to tag words based on their sentiment. Non-tagged words get filtered out in the end. 6. Get Original Data and Joined Sentiment Predictions. Here we execute a segment of the building workflow that joins the original data with joinedpredictions, when they exist. Recall that if a tweet/document does not have any sentimentword, it will have a neutral sentiment prediction associated with it. The quality of thesepredictions can then be evaluated by using this dataset in a web application or in a webservice. Here, we send the output back for testing purposes. 5. Calculate a Sentiment Score based on the Number of Positiveand Negative Words and Classify Documents based on the Score.The sentiment score is calculated by (number of postive words -number of negative words) divided by (number of postive words +number of negative words). If the score is negative it is classifiedas negative, if the score is positive it is classified as positive, and ifit is equal to 0 it is classified as neutral. 4. Count the Number of Positive and Negative Words perDocument.Here we re-use a shared component also present in thebuilding workflow. It encapsulates the counting of sentimentwords per document, separated by class. Step 1. Deploying the workflow to KNIME Server0. Add the workflow server mountpoint following theinstructions on the slides.1. Deploy the workflow group Session 2 - Exercises to theServer, inside the workflow group yourname.yoursurname.Make sure to include Workflow_Segments, Components andData folders.3. Schedule an execution of this workflow (2 min later) andsend yourself a notification on successfull/unsuccessfulexecution.4. (Spoiler) The workflow will fail. Open the workflow job onthe server and recognize the error5. It's time to fix the bug! Edit the local copy and re-deploy.Make sure to create a snapshot when deploying the fixedcopy.6. Execute again the deployed workflow on the server andcheck the produced results. Step 2(Optional). Workflow difference1.Open the Server History of the deployed workflow2.Select the last snapshot and download it locally3.Compare the old and new version locally with the WorkflowDifference function 7. Export the predicted sentiment to csv.Here we write the table with the text and thepredicted sentiment to a csv file. Execute data preparationworkflow overextracted tweetsExecute word taggingworkflow overextracted tweetsExecute result joiningworkflow overextracted tweets andsentiment predictionsRead tweets extractedwith the Twitter APINumbers of Positive andNegative Words per Tweet Column Rename Calculate Scores Call WorkflowService Call WorkflowService Call WorkflowService CSV Reader CSV Writer

Nodes

Extensions

Links