Sentiment Time Series

No algorithm description given

Introduction This algorithm combines the Social Sentiment Analysis algorithm and R time series to produce a sentiment plot showing positive, negative and neutral trends. It also produces a JSON file with the frequencies split into their sentiment and the corresponding dates to use in either the Forecast algorithm or another algorithm that requires frequency counts. Inputs This algorithm requires a JSON object as its input and all fields are required. The input_file field is required and is your csv file containing your timestamp and your comments. It must not contain headers and the timestamp must come first. "input_file" : "data://username/data_collection_name/time_comments.csv"
 Note:  The timestamp either must be in Unix Epoch datetime format OR a date format such as 2016/12/09. The later format can be of various date formats which you will pass in as another argument later. including the timestamp such as: 2016/10/19 18:42:46. The first column must be the timestamp for the algorithm to run. The benefit of using Unix Epoch is that you can pass in any date format that you want such as just the month and day. 9/12/2016, "Some message comment"
9/14/2016, "Some message comment" 1433392388, "Some message comment"
1432900542, "Some message comment" Remember, other formats are accepted and all will need their format passed in to the JSON object under the dt_format field. The output_plot field is required  and is the location of where you want to store the sentiment time series plot. It will need to be stored in your data collections. For more information see the Docs. "output_plot": "data://username/data_collection_name/sent_timeseries_plot.png" The  output_file  field is  required  and is the location of where you want to store the sentiment time series file that holds the JSON data. It will need to be stored in your data collections. For more information see the  Docs. "output_file": "data://username/data_collection_name/sent_freq_file.json" The start field is required and is a JSON array that holds the year and the month that the time series begins on while the end field holds the year and month that the dataset stops on. You can also pass in only the year. These fields are used to create the sentiment time series plot. "start": [2015, 4]
"end": [2016, 9] The freq field is also required and it is defined as the number of observations per unit of time, so if your data was collected once per day, then the frequency would be 365 while if it is by month then freq would be 12, etc. The dt_format  is required  and it will need to represent the date format that your data is in. For example if your date is: 5/26/2016 then your dt_format should be: "dt_format": "%m/%d/%Y" The tm_zone is required  and is the timezone your data was collected in.  Here is a full sample JSON input: {
 "input_file": "data://username/data_collection_name/time_comments.csv",
 "output_plot": "data://username/data_collection_name/sent_timeseries_plot.png",
 "output_file": "data://username/data_collection_name/sent_freq_file.json",
 "start": [2015, 4],
 "end": [2016,9],
 "freq": 12,
 "dt_format": "%m/%Y",
 "tm_zone": "GMT"
} Outputs This algorithm outputs two files, one an R generated plot of the sentiment time series and another that is the sentiment frequency JSON object. Sentiment Time Series Plot The sentiment time series tick marks will show the frequency on the y-axis and the time in numeric form (2016.05 for May of 2016) on the x-axis. The positive sentiment line will be shown in green, the negative in red and the neutral in blue. Sentiment Time Series Frequency JSON File The sentiment time series frequency JSON file is to be used with any forecasting algorithm and is split into positive, negative and neutral time series with the corresponding frequencies. {
"pos":{"tm":["01/01/2016","01/21/2016"], "freq":[2,1]},

"neg":{"tm":["02/13/2016","02/18/2016"], "freq":[1,1]},

"neu":{"tm":["01/02/2016","01/05/2016"], "freq":[1,1]}
}
 Note: Both the plot and the file outputs are determined in the input JSON object.

Tags
(no tags)

Cost Breakdown

0 cr
royalty per call
1 cr
usage per second
avg duration
This algorithm has permission to call other algorithms which may incur separate royalty and usage costs.

Cost Calculator

API call duration (sec)
×
API calls
=
Estimated cost
per calls
for large volume discounts
For additional details on how pricing works, see Algorithmia pricing.

Internet access

This algorithm has Internet access. This is necessary for algorithms that rely on external services, however it also implies that this algorithm is able to send your input data outside of the Algorithmia platform.


Calls other algorithms

This algorithm has permission to call other algorithms. This allows an algorithm to compose sophisticated functionality using other algorithms as building blocks, however it also carries the potential of incurring additional royalty and usage costs from any algorithm that it calls.


To understand more about how algorithm permissions work, see the permissions documentation.

1. Type your input

2. See the result

Running algorithm...

3. Use this algorithm

curl -X POST -d '{{input | formatInput:"curl"}}' -H 'Content-Type: application/json' -H 'Authorization: Simple YOUR_API_KEY' https://api.algorithmia.com/v1/algo/nlp/SentimentTimeSeries/0.1.0
View cURL Docs
algo auth
# Enter API Key: YOUR_API_KEY
algo run algo://nlp/SentimentTimeSeries/0.1.0 -d '{{input | formatInput:"cli"}}'
View CLI Docs
import com.algorithmia.*;
import com.algorithmia.algo.*;

String input = "{{input | formatInput:"java"}}";
AlgorithmiaClient client = Algorithmia.client("YOUR_API_KEY");
Algorithm algo = client.algo("algo://nlp/SentimentTimeSeries/0.1.0");
AlgoResponse result = algo.pipeJson(input);
System.out.println(result.asJsonString());
View Java Docs
import com.algorithmia._
import com.algorithmia.algo._

val input = {{input | formatInput:"scala"}}
val client = Algorithmia.client("YOUR_API_KEY")
val algo = client.algo("algo://nlp/SentimentTimeSeries/0.1.0")
val result = algo.pipeJson(input)
System.out.println(result.asJsonString)
View Scala Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
           .algo("algo://nlp/SentimentTimeSeries/0.1.0")
           .pipe(input)
           .then(function(output) {
             console.log(output);
           });
View Javascript Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
           .algo("algo://nlp/SentimentTimeSeries/0.1.0")
           .pipe(input)
           .then(function(response) {
             console.log(response.get());
           });
View NodeJS Docs
import Algorithmia

input = {{input | formatInput:"python"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('nlp/SentimentTimeSeries/0.1.0')
print algo.pipe(input)
View Python Docs
library(algorithmia)

input <- {{input | formatInput:"r"}}
client <- getAlgorithmiaClient("YOUR_API_KEY")
algo <- client$algo("nlp/SentimentTimeSeries/0.1.0")
result <- algo$pipe(input)$result
print(result)
View R Docs
require 'algorithmia'

input = {{input | formatInput:"ruby"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('nlp/SentimentTimeSeries/0.1.0')
puts algo.pipe(input).result
View Ruby Docs
use algorithmia::*;

let input = {{input | formatInput:"rust"}};
let client = Algorithmia::client("YOUR_API_KEY");
let algo = client.algo('nlp/SentimentTimeSeries/0.1.0');
let response = algo.pipe(input);
View Rust Docs
Discussion
  • {{comment.username}}