#r "nuget: Plotly.NET, 2.0.0-preview.6"
#r "nuget: Newtonsoft.Json"
#r "nuget: MathNet.Numerics.FSharp, 4.15.0"
open System
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
fsi.AddPrinter<DateTime>(fun dt -> dt.ToString("s"))
open Newtonsoft.Json
open Plotly.NET
open MathNet.Numerics.LinearAlgebra
type Label =
| Positive
| Negative
| Neutral
type LabeledTranscript =
{ TickerExchange: (string * string)
EarningsCall: string
CumulativeReturn: float
Label: Label }
let readJson (jsonFile: string) =
IO.File.ReadAllText(jsonFile)
|> fun json -> JsonConvert.DeserializeObject<array<LabeledTranscript>>(json)
let train, test =
let rnd = System.Random(42)
readJson ("data-cache/LabeledTranscriptsFullSample.json")
|> Seq.sortBy (fun _ -> rnd.Next())
|> Seq.toArray
|> fun xs ->
let cutoff = float xs.Length * 0.8
xs.[.. int cutoff], xs.[int cutoff + 1 ..]
Text data, unstructured data ...
- Change all words in each article to lower case letters
- Expand contractions such as "haven't" to "have not"
- Delete numbers, punctuation, special symbols, and non-English words
- Analyze words as a single root, e.g, "dissapointment" to "dissapoint"
- Porters algorithm
Split each article into a list of words or phrases or nGrams
Original: "The five boxing wizards jump quickly"
1Gram:
- ["The", "five", "boxing", "wizards", "jump", "quickly"]
2Grams:
- ["The five", "five boxing", "boxing wizards", "wizards jump", "jump quickly"]
- Transform each block of text to a vector of word counts
#load "TextPreprocessing.fsx"
open Preprocessing.Normalization
open Preprocessing.Tokenization
open Preprocessing.NltkData
type CallId =
{Ticker: string; Exchange: string}
type WordCount =
{Word: string; Count: int}
type Sentiment =
| Positive
| Negative
type Call =
{ CallId: CallId
WordCount: WordCount []
Signal: float } with
member this.Flag =
if this.Signal > 0. then Positive
else Negative
let preprocessText (text: string) =
// Normalization
text
|> getOnlyWords
|> expandContractions
// Tokenization
|> nGrams 1
// Stop words removal
|> Seq.choose removeStopWords
let generateCall (xs: LabeledTranscript) =
let callId = {Ticker = fst xs.TickerExchange ; Exchange = snd xs.TickerExchange}
let wordCount =
xs.EarningsCall
|> preprocessText
// Bag of words
|> Seq.countBy id
|> Seq.map (fun (word, count) -> {Word=word; Count=count})
|> Seq.toArray
{ CallId = callId
WordCount = wordCount
Signal = xs.CumulativeReturn }
let trainCalls, testCalls =
train
|> Array.Parallel.map generateCall,
test
|> Array.Parallel.map generateCall
Topic detection or topic modeling is a technique of automatically extracting meaning from texts
by identifying recurrent themes or topics.
Topic modeling is a method for analyzing large volumes of unlabeld text data. It helps in:
- Discovering hidden topical patterns that are present across the collection
- Annotating documents according to these topics
- Using these annotations to organize, search and summarize texts
A topic consists of a cluster of words that frequently occur together.
This is essentially a clustering problem - we can think of both words and documents as being clustered.
There are many techniques that are used to obtain topic models. One of the commonly used is
Latent Dirichlet Allocation (LDA)
SESTM: A Supervised Sentiment Extraction Algorithm
Methodology:
Feature selection: create a set of sentiment-charged words via predictive (correlation) screening
- Assign prediction/sentiment weights to these words via a supervised topic model (i.e. estimate positive and negative sentiment topics)
- Aggregate terms into an article-level predictive score via penalized likelihood.
-
Model is motivated by the view that return-predictive content of a given event is
reflected both in the news article text and in the returns of related assets.
Method has an objective of extracting general return predictive content from text.
Advantages
-
Simplicity: only requires standard econometric techniques such as correlation analysis and maximum likelihood estimation.
Additionally, unlike other deep learning approaches, the proposed supervised learning approach is entirely "white-box".
- Minimal computing power required.
- Free of any pre-existing sentiment dictionary (polarized words, sentiment lexicons, etc...). No use of ad hoc word-weighting schemes.
Bottom line: A sentiment scoring model is constructed from the joint behaviour of
article text and stock returns.
Theoretical Reusults
- The guarantee of retrieving a sentiment dictionary from training data via correlation screening.
-
The derivation of sharp error bounds for parameter estimation. The error bounds depend on the scale
of the corpus (e.g., size of the vocabulary, total number of text documents, average number of words
per document, etc.), and the strength of sentiment signals (e.g., the sentivity of returns to sentiment,
sensitivity of text generation to sentiment, etc.).
- The error of predicting the sentiment score of a newly arriving article is both derived and quantified.
Objective: Isolate the subset of sentiment-charged words (remove sentiment-neutral words, i.e. noise).
Intuitively, if a word frequently co-occurs in articles that are accompanied
by positive returns, that word is likely to convey positive sentiment.
Methodology:
-
Calculate the frequency with which each word (or phrase) j co-occurs with a positive
return. (screening-score \(f_{j}\))
Compare \(f_{j}\) with proper thresholds and create the sentiment-charged set of words \(S\).
Before computing any scores, we need to first find out the frequency and "occurence" of each word or text item in the corpus of documents.
While the frequency of each text item or word is simply its total count across all documents, an item's occurence is equivalent to the total count of documents that include it.
/// Vector of item counts per Group (Flag) (Bag of words per group)
let itemOccurenceByGroup, itemFrequencyByGroup =
trainCalls
|> Seq.groupBy (fun xs -> xs.Flag)
|> Seq.map (fun (group, callsOfGroup) ->
callsOfGroup
|> Seq.collect (fun xs -> xs.WordCount)
|> Seq.groupBy (fun xs -> xs.Word)
|> Seq.map (fun (wordId, wordCounts) ->
wordCounts
|> fun xs ->
// Occurence (# of articles that word j appears)
(wordId, xs |> Seq.length),
// Frequency (total count of word j in all articles)
(wordId, xs |> Seq.sumBy (fun xs -> xs.Count)))
|> Seq.toArray
|> fun xs ->
(group, xs |> Array.map fst |> Map),
(group, xs |> Array.map snd |> Map))
|> Seq.toArray
|> fun xs ->
(xs |> Array.map fst |> Map),
(xs |> Array.map snd |> Map)
/// Frequency/Occurence finder
let countOfItemInGroup (group: Sentiment)
(wordSentimentMap : Map<Sentiment, Map<string, int>>)
(item: string) =
wordSentimentMap.TryFind group
|> Option.bind (fun xs -> xs.TryFind item)
countOfItemInGroup Positive itemFrequencyByGroup "sales"
countOfItemInGroup Positive itemOccurenceByGroup "sales"
While the frequency of each text item or word is simply its total count across all documents, an item's occurence is equivalent to the total count of documents that include text item j.
We can then define two variants of screening scores:
- Screening score based on total word frequency:
\[f_{j} = \frac{{\text{count of word } j \text{ in articles with } sgn(y) = +1 }}{\text{count of word } j \text{ in all articles}} \]
- Screening score based on word occurence across documents:
\[f_{j}^{*} = \frac{{\text{count of articles including word } j \text{ in articles with } sgn(y) = +1 }}{\text{count of articles including word } j }\]
type CountType =
| Frequency
| Occurence
type TextItemScreening =
{ TextItem: string
Score: float
Count: float
CountType: CountType }
/// Vocabulary (training set only)
let vocabulary =
trainCalls
|> Seq.collect (fun xs -> xs.WordCount |> Array.map (fun xs -> xs.Word))
|> Seq.distinct
|> Seq.toArray
/// Get scores from given word sentiment map (Frequency or Occurence)
let getScores (wordSentimentMap: Map<Sentiment, Map<string, int>>)
(countType: CountType) =
let getItemScore item =
let generateItemScore item score count =
{TextItem = item; Score = score; Count = count; CountType = countType }
let posN, negN =
countOfItemInGroup Positive wordSentimentMap item,
countOfItemInGroup Negative wordSentimentMap item
match posN, negN with
| Some p, Some n ->
let count = float (p + n)
let score = (float p) / count
Some (generateItemScore item score count)
| Some p, None ->
let score, count = 1., float p
Some (generateItemScore item score count)
| None, Some n ->
let score, count = 0., float n
Some (generateItemScore item score count)
| _ -> None
vocabulary
// Compute text item scores
|> Array.Parallel.choose getItemScore
|> Array.map (fun xs -> xs.TextItem, xs)
|> Map
let itemOccurenceScores, itemFrequencyScores =
getScores itemOccurenceByGroup Occurence,
getScores itemFrequencyByGroup Frequency
Histogram: Item scores
itemFrequencyScores
|> Map.toArray
|> Array.map (fun (word, xs) -> xs.Score)
|> Array.filter (fun xs -> xs > 0.25 && xs < 0.75)
|> Chart.Histogram
|> Chart.Show
\[\widehat{S} = \{j: f_{j} \geq \widehat{\pi} + \alpha_{+}, \text{ or } f_{j} \leq \widehat{\pi} - \alpha_{-} \} \cap \{ j: k_{j} \geq \kappa\}\]
- \(f_{j} = \text{Sentiment-screening score of word } j\)
- \(\widehat{\pi} = \text{Fraction of articles tagged with a positive return}\)
- \(\alpha_{+} = \text{Upper sentiment-score threshold}\)
- \(\alpha_{-} = \text{Lower sentiment-score threshold}\)
- \(k_{j} = \text{count of word } j \text{ in all articles}\)
The thresholds (\(\alpha{+}, \alpha{-}, \kappa\)) are hyper-parameters that can be tuned via cross-validation.
/// Sentiment-charged words
let getChargedItems alphaLower alphaUpper kappaPct =
// Count of text item in all articles
let kappa = kappaPct * float train.Length
// Upper and lower score thresholds
let upperThresh, lowerThresh =
trainCalls
|> Array.filter (fun xs -> xs.Flag = Positive)
|> fun xs -> float xs.Length / float train.Length
|> fun pieHat -> (pieHat + alphaUpper), (pieHat - alphaLower)
let isCharged item =
match itemFrequencyScores.TryFind item, itemOccurenceScores.TryFind item with
| Some freqScore, Some occScore ->
if ((freqScore.Score >= upperThresh || freqScore.Score <= lowerThresh) && (occScore.Count >= kappa))
then Some item
else None
| _ -> None
vocabulary
|> Array.choose isCharged
let alphaLower, alphaUpper, kappa = (0.0075, 0.0075, 0.5)
let chargedItems = getChargedItems alphaLower alphaUpper kappa
chargedItems.Length
let filterCall (call: Call): Call =
let textItemsFromCall =
call.WordCount
|> Array.map (fun xs -> xs.Word, xs)
|> Map
let filteredItemCounts =
chargedItems
|> Array.map (fun chargedWord ->
match textItemsFromCall.TryFind chargedWord with
| Some wordCount -> wordCount
| None -> {Word=chargedWord; Count = 0})
|> Array.sortBy (fun xs -> xs.Word)
{ CallId = call.CallId
WordCount = filteredItemCounts
Signal = call.Signal }
let chargedTrain =
trainCalls
|> Array.Parallel.map filterCall
// Remove "empty document vectors"
|> Array.filter (fun xs -> xs.WordCount |> Array.sumBy (fun xs -> xs.Count) |> fun xs -> xs <> 0)
let getDocumentTermMatrix (calls: Call []) =
calls
|> Array.sortBy (fun xs -> xs.Signal)
|> Array.map (fun xs ->
xs.WordCount
|> Array.map (fun xs -> double xs.Count))
|> matrix
|> fun xs -> xs.Transpose()
let chargedDocumentTermMatrix = getDocumentTermMatrix chargedTrain
chargedDocumentTermMatrix.RowCount
chargedDocumentTermMatrix.ColumnCount
Fitting a two-topic model to the sentiment-charged counts, chargedItemCountsById
.
Some notation:
\[\text{Consider a collection of } n \text{ articles and a dictionary of } m \text{ words.}\]
\[d_{i} = \text{word or (phrase) counts of the } i^{th} article\]
\[d_{i, j} = \text{ number of times word } j \text{ occurs in article } i\]
\[D = m \times n \text{ document term matrix}; D = [d_{1}, ..., d{n}]\]
Model:
\[d_{[S], i} \sim \text{Multinomial} (s_{i}, p_{i}O_{+} + (1 - p_{i})O_{-})\]
\[p_{i} = \text{ article's sentiment score, } p_{i} \in [0,1]\]
\[s_{i} = \text{ total count of sentiment-charged words in article } i\]
\[O_{+} = \text{ positive sentiment topic}\]
\[O_{-} = \text{ negative sentiment topic}\]
\[\mathbb{E}h_{i} = \mathbb{E}\frac{d_{[S], i}}{s_{i}} = p_{i}O_{+} + (1 -p_{i})O_{-}\]
Estimate \[H\] by plugging in \[\widehat{S}\] from screening step:
\[\widehat{h_{i}} = \frac{d_{[\widehat{S}], i}}{\widehat{s}_{i}}\]
\[\widehat{s}_{i} = \sum_{j \in \widehat{S}}{d_{j, i}}\]
Estimate W using the standardized ranks of returns. For each each article \[i\] in the training sample \[i = 1, ..., n\]:
\[\widehat{p}_{i} = \frac{\text{rank of } y_{i} \text{ in } \{y_{l}\}_{l=1}^{n}}{n}\]
\[\widehat{H} = [\widehat{h_{1}}, \widehat{h_{2}},..., \widehat{h_{3}}]\]
\[\widehat{h_{i}} = \frac{d_{[\widehat{S}], i}}{\widehat{s}_{i}} \text{ } \widehat{s}_{i} = \sum_{j \in \widehat{S}}{d_{j, i}}\]
let bigH =
chargedDocumentTermMatrix
|> fun m ->
m.ToColumnArrays()
|> Array.map (fun itemCounts ->
let sumOfItemCounts =
Array.sum itemCounts
itemCounts
|> Array.map (fun xs -> xs / sumOfItemCounts))
|> matrix
|> fun xs -> xs.Transpose()
bigH.RowCount
bigH.ColumnCount
\[\widehat{W} = \begin{bmatrix} \widehat{p_{1}} & \widehat{p_{2}} & \cdots & \widehat{p_{n}} \\ 1 - \widehat{p_{1}} & 1 - \widehat{p_{2}} & \cdots & 1 -\widehat{p_{n}} \end{bmatrix}\]
\[\widehat{p}_{i} = \frac{\text{rank of } y_{i} \text{ in } \{y_{l}\}_{l=1}^{n}}{n}\]
let bigW =
let n =
double chargedDocumentTermMatrix.ColumnCount
chargedDocumentTermMatrix.ToColumnArrays()
|> Array.mapi (fun i _ ->
double (i + 1)/ n)
|> fun xs ->
matrix [|xs; xs |> Array.map (fun p -> (1. - p))|]
bigW.RowCount
bigW.ColumnCount
bigH.Multiply(bigW.Transpose())
\[\widehat{O} = [\widehat{h_{1}}, \widehat{h_{2}},\ldots, \widehat{h_{n}}] \widehat{W}^{'} (\widehat{W}\widehat{W}^{'})^{-1}\]
let bigO =
let h, w, w' = bigH, bigW, bigW.Transpose()
let ww' = w.Multiply(w')
h.Multiply(w').Multiply(ww'.Inverse())
|> Matrix.toColArrays
|> Array.map (fun col ->
col
|> Array.map (fun xs -> if xs < 0. then 0. else xs)
|> fun onlyPositiveVals ->
let norm = Array.sum onlyPositiveVals
onlyPositiveVals
|> Array.map (fun xs -> xs / norm))
|> matrix
|> fun m -> m.Transpose()
bigO.RowCount
bigO.ColumnCount
Estimating \(p\) (sentiment score) for new articles using maximum likelihood estimation:
\[\widehat{p} = \arg\max_{p\in[\,0, 1]\,} \left\{\hat{s}^{-1} \sum_{j \in \widehat{S}}{d_{j}\log \left(p \widehat{O}_{+, j} + (\,1-p)\,\widehat{O}_{-, j}\right) + \lambda \log \left(p\left(1 - p \right)\right) \right\}\]
\(\hat{s}\text{ is the total count of words from } \widehat{S} \text{ in the new article,} \left(d_{j}, \widehat{O}_{+, j}, \widehat{O}_{-, j} \right) \text{ are the } j \text{th entries of the corresponding vectors, and } \lamda\)
For sentiment charged words, their corresponding entries in \(O\) should be different. Otherwise, these words would not represent any sentiment and should be left out of the set of sentiment charged words. Sentiment neutral words are analogous to useless predictors in a linear model.
Optimization
let bigOArr =
bigO.ToRowArrays()
let objF (call: Call) (p: float) (lambda: float) =
let filteredCall = filterCall call
let sHat =
filteredCall
|> fun xs ->
xs.WordCount
|> Array.sumBy (fun xs -> xs.Count)
|> fun xs -> (1. / float xs)
filteredCall.WordCount
|> Array.mapi (fun i xs ->
let pos = p * bigOArr.[i].[0]
let neg = (1. - p) * bigOArr.[i].[1]
let d = float xs.Count
d * log (pos + neg))
|> fun expr ->
(sHat *(Array.sum expr))
let computeScore (call: Call) =
[|0. .. 0.01 .. 1.|]
|> Array.map (fun scoreP -> (scoreP, call.Signal), (objF call scoreP 0.00001))
|> Array.maxBy snd
let testHighSignals =
testCalls
|> Array.take 100
|> Array.map (fun xs ->
let res = computeScore xs
res)
|> Array.sortBy snd
let testLowSignals =
testCalls
|> Array.sortBy (fun xs -> xs.Signal)
|> Array.take 500
|> Array.averageBy (fun xs ->
let res = computeScore xs |> fst
res |> fst)
DiffSharp demo
#r "nuget: DiffSharp-lite, 1.0.0-preview-987646120"
open DiffSharp
open DiffSharp.Optim
let computeScore' (call: Call) (x: Tensor) =
let filteredCall = filterCall call
let sHat =
filteredCall
|> fun xs ->
xs.WordCount
|> Array.sumBy (fun xs -> xs.Count)
|> fun xs -> (1. / float xs)
let scoreP = x.[0]
filteredCall.WordCount
|> Array.mapi (fun i xs ->
let pos = scoreP * bigOArr.[i].[0]
let neg = (1. - scoreP) * bigOArr.[i].[1]
let d = float xs.Count
d * log (pos + neg))
|> Array.sum
|> fun sumExpr ->
(sHat * sumExpr) + (0.001 * log (scoreP * (1. - scoreP)))
|> fun xs -> xs * -1.
let lr, momentum, iters, threshold = 1e-3, 0.5, 1000, 1e-3
let scoreFun = computeScore' negativeArticleTrain
let scorePGuess = dsharp.tensor([0.5])
let scoreFx, params' = optim.sgd(scoreFun, scorePGuess, lr=dsharp.tensor(lr), momentum=dsharp.tensor(momentum), nesterov=true, iters=iters, threshold=threshold)
namespace System
type Environment =
static member Exit : exitCode: int -> unit
static member ExpandEnvironmentVariables : name: string -> string
static member FailFast : message: string -> unit + 1 overload
static member GetCommandLineArgs : unit -> string []
static member GetEnvironmentVariable : variable: string -> string + 1 overload
static member GetEnvironmentVariables : unit -> IDictionary + 1 overload
static member GetFolderPath : folder: SpecialFolder -> string + 1 overload
static member GetLogicalDrives : unit -> string []
static member SetEnvironmentVariable : variable: string * value: string -> unit + 1 overload
static member CommandLine : string
...
<summary>Provides information about, and means to manipulate, the current environment and platform. This class cannot be inherited.</summary>
property Environment.CurrentDirectory: string with get, set
<summary>Gets or sets the fully qualified path of the current working directory.</summary>
<exception cref="T:System.ArgumentException">Attempted to set to an empty string ("").</exception>
<exception cref="T:System.ArgumentNullException">Attempted to set to <see langword="null" />.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">Attempted to set a local path that cannot be found.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the appropriate permission.</exception>
<returns>The directory path.</returns>
Multiple items
[<Struct>]
type DateTime =
new : year: int * month: int * day: int -> unit + 10 overloads
member Add : value: TimeSpan -> DateTime
member AddDays : value: float -> DateTime
member AddHours : value: float -> DateTime
member AddMilliseconds : value: float -> DateTime
member AddMinutes : value: float -> DateTime
member AddMonths : months: int -> DateTime
member AddSeconds : value: float -> DateTime
member AddTicks : value: int64 -> DateTime
member AddYears : value: int -> DateTime
...
<summary>Represents an instant in time, typically expressed as a date and time of day.</summary>
--------------------
DateTime ()
(+0 other overloads)
DateTime(ticks: int64) : DateTime
(+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : DateTime
(+0 other overloads)
namespace Newtonsoft
namespace Newtonsoft.Json
namespace Plotly
namespace Plotly.NET
namespace MathNet
namespace MathNet.Numerics
namespace MathNet.Numerics.LinearAlgebra
type Label =
| Positive
| Negative
| Neutral
union case Label.Positive: Label
union case Label.Negative: Label
union case Label.Neutral: Label
type LabeledTranscript =
{ TickerExchange: string * string
EarningsCall: string
CumulativeReturn: float
Label: Label }
LabeledTranscript.TickerExchange: string * string
Multiple items
val string : value:'T -> string
<summary>Converts the argument to a string using <c>ToString</c>.</summary>
<remarks>For standard integer and floating point values the and any type that implements <c>IFormattable</c><c>ToString</c> conversion uses <c>CultureInfo.InvariantCulture</c>. </remarks>
<param name="value">The input value.</param>
<returns>The converted string.</returns>
--------------------
type string = String
<summary>An abbreviation for the CLI type <see cref="T:System.String" />.</summary>
<category>Basic Types</category>
LabeledTranscript.EarningsCall: string
LabeledTranscript.CumulativeReturn: float
Multiple items
val float : value:'T -> float (requires member op_Explicit)
<summary>Converts the argument to 64-bit float. This is a direct conversion for all
primitive numeric types. For strings, the input is converted using <c>Double.Parse()</c>
with InvariantCulture settings. Otherwise the operation requires an appropriate
static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted float</returns>
--------------------
[<Struct>]
type float = Double
<summary>An abbreviation for the CLI type <see cref="T:System.Double" />.</summary>
<category>Basic Types</category>
--------------------
type float<'Measure> =
float
<summary>The type of double-precision floating point numbers, annotated with a unit of measure.
The unit of measure is erased in compiled code and when values of this type
are analyzed using reflection. The type is representationally equivalent to
<see cref="T:System.Double" />.</summary>
<category index="6">Basic Types with Units of Measure</category>
Multiple items
LabeledTranscript.Label: Label
--------------------
type Label =
| Positive
| Negative
| Neutral
val readJson : jsonFile:string -> LabeledTranscript array
val jsonFile : string
namespace System.IO
type File =
static member AppendAllLines : path: string * contents: IEnumerable<string> -> unit + 1 overload
static member AppendAllLinesAsync : path: string * contents: IEnumerable<string> * encoding: Encoding *?cancellationToken: CancellationToken -> Task + 1 overload
static member AppendAllText : path: string * contents: string -> unit + 1 overload
static member AppendAllTextAsync : path: string * contents: string * encoding: Encoding *?cancellationToken: CancellationToken -> Task + 1 overload
static member AppendText : path: string -> StreamWriter
static member Copy : sourceFileName: string * destFileName: string -> unit + 1 overload
static member Create : path: string -> FileStream + 2 overloads
static member CreateText : path: string -> StreamWriter
static member Decrypt : path: string -> unit
static member Delete : path: string -> unit
...
<summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary>
IO.File.ReadAllText(path: string) : string
IO.File.ReadAllText(path: string, encoding: Text.Encoding) : string
val json : string
type JsonConvert =
static member DeserializeAnonymousType<'T> : value: string * anonymousTypeObject: 'T -> 'T + 1 overload
static member DeserializeObject : value: string -> obj + 7 overloads
static member DeserializeXNode : value: string -> XDocument + 3 overloads
static member DeserializeXmlNode : value: string -> XmlDocument + 3 overloads
static member EnsureDecimalPlace : value: float * text: string -> string + 1 overload
static member EnsureFloatFormat : value: float * text: string * floatFormatHandling: FloatFormatHandling * quoteChar: char * nullable: bool -> string
static member PopulateObject : value: string * target: obj -> unit + 1 overload
static member SerializeObject : value: obj -> string + 7 overloads
static member SerializeObjectInternal : value: obj * type: Type * jsonSerializer: JsonSerializer -> string
static member SerializeXNode : node: XObject -> string + 2 overloads
...
<summary>
Provides methods for converting between .NET types and JSON types.
</summary>
<example><code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializeObject" title="Serializing and Deserializing JSON with JsonConvert" /></example>
JsonConvert.DeserializeObject<'T>(value: string) : 'T
JsonConvert.DeserializeObject(value: string) : obj
JsonConvert.DeserializeObject<'T>(value: string, settings: JsonSerializerSettings) : 'T
JsonConvert.DeserializeObject<'T>(value: string, [<ParamArray>] converters: JsonConverter []) : 'T
JsonConvert.DeserializeObject(value: string, type: Type) : obj
JsonConvert.DeserializeObject(value: string, settings: JsonSerializerSettings) : obj
JsonConvert.DeserializeObject(value: string, type: Type, settings: JsonSerializerSettings) : obj
JsonConvert.DeserializeObject(value: string, type: Type, [<ParamArray>] converters: JsonConverter []) : obj
type 'T array = 'T []
<summary>Single dimensional, zero-based arrays, written <c>int[]</c>, <c>string[]</c> etc.</summary>
<remarks>Use the values in the <see cref="T:Microsoft.FSharp.Collections.ArrayModule" /> module to manipulate values
of this type, or the notation <c>arr.[x]</c> to get/set array
values.</remarks>
<category>Basic Types</category>
val train : LabeledTranscript []
val test : LabeledTranscript []
val rnd : Random
Multiple items
type Random =
new : unit -> unit + 1 overload
member Next : unit -> int + 2 overloads
member NextBytes : buffer: byte [] -> unit + 1 overload
member NextDouble : unit -> float
member Sample : unit -> float
<summary>Represents a pseudo-random number generator, which is an algorithm that produces a sequence of numbers that meet certain statistical requirements for randomness.</summary>
--------------------
Random() : Random
Random(Seed: int) : Random
Multiple items
module Seq
from Plotly.NET
--------------------
module Seq
from Microsoft.FSharp.Collections
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Collections.seq`1" />.</summary>
val sortBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> (requires comparison)
<summary>Applies a key-generating function to each element of a sequence and yield a sequence ordered
by keys. The keys are compared using generic comparison as implemented by <see cref="M:Microsoft.FSharp.Core.Operators.compare" />.</summary>
<remarks>This function returns a sequence that digests the whole initial sequence as soon as
that sequence is iterated. As a result this function should not be used with
large or infinite sequences.
The function makes no assumption on the ordering of the original
sequence and uses a stable sort, that is the original order of equal elements is preserved.</remarks>
<param name="projection">A function to transform items of the input sequence into comparable keys.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
Random.Next() : int
Random.Next(maxValue: int) : int
Random.Next(minValue: int, maxValue: int) : int
val toArray : source:seq<'T> -> 'T []
<summary>Builds an array from the given collection.</summary>
<param name="source">The input sequence.</param>
<returns>The result array.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val xs : LabeledTranscript []
val cutoff : float
property Array.Length: int with get
<summary>Gets the total number of elements in all the dimensions of the <see cref="T:System.Array" />.</summary>
<exception cref="T:System.OverflowException">The array is multidimensional and contains more than <see cref="F:System.Int32.MaxValue" /> elements.</exception>
<returns>The total number of elements in all the dimensions of the <see cref="T:System.Array" />; zero if there are no elements in the array.</returns>
Multiple items
val int : value:'T -> int (requires member op_Explicit)
<summary>Converts the argument to signed 32-bit integer. This is a direct conversion for all
primitive numeric types. For strings, the input is converted using <c>Int32.Parse()</c>
with InvariantCulture settings. Otherwise the operation requires an appropriate
static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted int</returns>
--------------------
[<Struct>]
type int = int32
<summary>An abbreviation for the CLI type <see cref="T:System.Int32" />.</summary>
<category>Basic Types</category>
--------------------
type int<'Measure> =
int
<summary>The type of 32-bit signed integer numbers, annotated with a unit of measure. The unit
of measure is erased in compiled code and when values of this type
are analyzed using reflection. The type is representationally equivalent to
<see cref="T:System.Int32" />.</summary>
<category>Basic Types with Units of Measure</category>
namespace Preprocessing
module Normalization
from Preprocessing
module Tokenization
from Preprocessing
module NltkData
from Preprocessing
type CallId =
{ Ticker: string
Exchange: string }
CallId.Ticker: string
CallId.Exchange: string
type WordCount =
{ Word: string
Count: int }
WordCount.Word: string
WordCount.Count: int
type Sentiment =
| Positive
| Negative
union case Sentiment.Positive: Sentiment
union case Sentiment.Negative: Sentiment
Multiple items
Call.CallId: CallId
--------------------
type CallId =
{ Ticker: string
Exchange: string }
Multiple items
Call.WordCount: WordCount []
--------------------
type WordCount =
{ Word: string
Count: int }
Call.Signal: float
val this : Call
val preprocessText : text:string -> seq<string>
val text : string
val getOnlyWords : text:string -> string
Check for *only* words (Regex)
val expandContractions : textItem:string -> string
val nGrams : n:int -> text:string -> string []
NGrams Tokenizer
val choose : chooser:('T -> 'U option) -> source:seq<'T> -> seq<'U>
<summary>Applies the given function to each element of the list. Return
the list comprised of the results "x" for each element where
the function returns Some(x).</summary>
<remarks>The returned sequence may be passed between threads safely. However,
individual IEnumerator values generated from the returned sequence should not
be accessed concurrently.</remarks>
<param name="chooser">A function to transform items of type T into options of type U.</param>
<param name="source">The input sequence of type T.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val removeStopWords : textItem:string -> string option
val generateCall : xs:LabeledTranscript -> Call
val xs : LabeledTranscript
val callId : CallId
val fst : tuple:('T1 * 'T2) -> 'T1
<summary>Return the first element of a tuple, <c>fst (a,b) = a</c>.</summary>
<param name="tuple">The input tuple.</param>
<returns>The first value.</returns>
val snd : tuple:('T1 * 'T2) -> 'T2
<summary>Return the second element of a tuple, <c>snd (a,b) = b</c>.</summary>
<param name="tuple">The input tuple.</param>
<returns>The second value.</returns>
val wordCount : WordCount []
val countBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * int> (requires equality)
<summary>Applies a key-generating function to each element of a sequence and returns a sequence yielding unique
keys and their number of occurrences in the original sequence.</summary>
<remarks>Note that this function returns a sequence that digests the whole initial sequence as soon as
that sequence is iterated. As a result this function should not be used with
large or infinite sequences. The function makes no assumption on the ordering of the original
sequence.</remarks>
<param name="projection">A function transforming each item of the input sequence into a key to be
compared against the others.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val id : x:'T -> 'T
<summary>The identity function</summary>
<param name="x">The input value.</param>
<returns>The same value.</returns>
val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U>
<summary>Builds a new collection whose elements are the results of applying the given function
to each of the elements of the collection. The given function will be applied
as elements are demanded using the <c>MoveNext</c> method on enumerators retrieved from the
object.</summary>
<remarks>The returned sequence may be passed between threads safely. However,
individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
<param name="mapping">A function to transform items from the input sequence.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val word : string
val count : int
val trainCalls : Call []
val testCalls : Call []
type Array =
interface ICollection
interface IEnumerable
interface IList
interface IStructuralComparable
interface IStructuralEquatable
interface ICloneable
new : unit -> unit
member Clone : unit -> obj
member CopyTo : array: Array * index: int -> unit + 1 overload
member GetEnumerator : unit -> IEnumerator
...
<summary>Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.</summary>
module Parallel
from Microsoft.FSharp.Collections.ArrayModule
<summary>Provides parallel operations on arrays </summary>
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []
<summary>Build a new array whose elements are the results of applying the given function
to each of the elements of the array.</summary>
<remarks>Performs the operation in parallel using <see cref="M:System.Threading.Tasks.Parallel.For" />.
The order in which the given function is applied to elements of the input array is not specified.</remarks>
<param name="mapping"></param>
<param name="array">The input array.</param>
<returns>The array of results.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val itemOccurenceByGroup : Map<Sentiment,Map<string,int>>
Vector of item counts per Group (Flag) (Bag of words per group)
val itemFrequencyByGroup : Map<Sentiment,Map<string,int>>
Vector of item counts per Group (Flag) (Bag of words per group)
val groupBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * seq<'T>> (requires equality)
<summary>Applies a key-generating function to each element of a sequence and yields a sequence of
unique keys. Each unique key contains a sequence of all elements that match
to this key.</summary>
<remarks>This function returns a sequence that digests the whole initial sequence as soon as
that sequence is iterated. As a result this function should not be used with
large or infinite sequences. The function makes no assumption on the ordering of the original
sequence.</remarks>
<param name="projection">A function that transforms an element of the sequence into a comparable key.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
val xs : Call
property Call.Flag: Sentiment with get
val group : Sentiment
val callsOfGroup : seq<Call>
val collect : mapping:('T -> #seq<'U>) -> source:seq<'T> -> seq<'U>
<summary>Applies the given function to each element of the sequence and concatenates all the
results.</summary>
<remarks>Remember sequence is lazy, effects are delayed until it is enumerated.</remarks>
<param name="mapping">A function to transform elements of the input sequence into the sequences
that will then be concatenated.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
Call.WordCount: WordCount []
val xs : WordCount
val wordId : string
val wordCounts : seq<WordCount>
val xs : seq<WordCount>
val length : source:seq<'T> -> int
<summary>Returns the length of the sequence</summary>
<param name="source">The input sequence.</param>
<returns>The length of the sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val sumBy : projection:('T -> 'U) -> source:seq<'T> -> 'U (requires member ( + ) and member get_Zero)
<summary>Returns the sum of the results generated by applying the function to each element of the sequence.</summary>
<remarks>The generated elements are summed using the <c>+</c> operator and <c>Zero</c> property associated with the generated type.</remarks>
<param name="projection">A function to transform items from the input sequence into the type that will be summed.</param>
<param name="source">The input sequence.</param>
<returns>The computed sum.</returns>
val xs : ((string * int) * (string * int)) []
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []
<summary>Builds a new array whose elements are the results of applying the given function
to each of the elements of the array.</summary>
<param name="mapping">The function to transform elements of the array.</param>
<param name="array">The input array.</param>
<returns>The array of transformed elements.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
Multiple items
module Map
from Microsoft.FSharp.Collections
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Collections.Map`2" />.</summary>
--------------------
type Map<'Key,'Value (requires comparison)> =
interface IReadOnlyDictionary<'Key,'Value>
interface IReadOnlyCollection<KeyValuePair<'Key,'Value>>
interface IEnumerable
interface IComparable
interface IEnumerable<KeyValuePair<'Key,'Value>>
interface ICollection<KeyValuePair<'Key,'Value>>
interface IDictionary<'Key,'Value>
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
member Add : key:'Key * value:'Value -> Map<'Key,'Value>
member Change : key:'Key * f:('Value option -> 'Value option) -> Map<'Key,'Value>
...
<summary>Immutable maps based on binary trees, where keys are ordered by F# generic comparison. By default
comparison is the F# structural comparison function or uses implementations of the IComparable interface on key values.</summary>
<remarks>See the <see cref="T:Microsoft.FSharp.Collections.MapModule" /> module for further operations on maps.
All members of this class are thread-safe and may be used concurrently from multiple threads.</remarks>
--------------------
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
val xs : ((Sentiment * Map<string,int>) * (Sentiment * Map<string,int>)) []
val countOfItemInGroup : group:Sentiment -> wordSentimentMap:Map<Sentiment,Map<string,int>> -> item:string -> int option
Frequency/Occurence finder
val wordSentimentMap : Map<Sentiment,Map<string,int>>
val item : string
member Map.TryFind : key:'Key -> 'Value option
module Option
from Microsoft.FSharp.Core
<summary>Contains operations for working with options.</summary>
<category>Options</category>
val bind : binder:('T -> 'U option) -> option:'T option -> 'U option
<summary><c>bind f inp</c> evaluates to <c>match inp with None -> None | Some x -> f x</c></summary>
<param name="binder">A function that takes the value of type T from an option and transforms it into
an option containing a value of type U.</param>
<param name="option">The input option.</param>
<example><code>
let tryParse input =
match System.Int32.TryParse input with
| true, v -> Some v
| false, _ -> None
None |> Option.bind tryParse // evaluates to None
Some "42" |> Option.bind tryParse // evaluates to Some 42
Some "Forty-two" |> Option.bind tryParse // evaluates to None
</code></example>
<returns>An option of the output type of the binder.</returns>
val xs : Map<string,int>
type CountType =
| Frequency
| Occurence
union case CountType.Frequency: CountType
union case CountType.Occurence: CountType
type TextItemScreening =
{ TextItem: string
Score: float
Count: float
CountType: CountType }
TextItemScreening.TextItem: string
TextItemScreening.Score: float
TextItemScreening.Count: float
Multiple items
TextItemScreening.CountType: CountType
--------------------
type CountType =
| Frequency
| Occurence
val vocabulary : string []
Vocabulary (training set only)
val distinct : source:seq<'T> -> seq<'T> (requires equality)
<summary>Returns a sequence that contains no duplicate entries according to generic hash and
equality comparisons on the entries.
If an element occurs multiple times in the sequence then the later occurrences are discarded.</summary>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val getScores : wordSentimentMap:Map<Sentiment,Map<string,int>> -> countType:CountType -> Map<string,TextItemScreening>
Get scores from given word sentiment map (Frequency or Occurence)
val countType : CountType
val getItemScore : (string -> TextItemScreening option)
val generateItemScore : (string -> float -> float -> TextItemScreening)
val score : float
val count : float
val posN : int option
val negN : int option
union case Option.Some: Value: 'T -> Option<'T>
<summary>The representation of "Value of type 'T"</summary>
<param name="Value">The input value.</param>
<returns>An option representing the value.</returns>
val p : int
val n : int
union case Option.None: Option<'T>
<summary>The representation of "No value"</summary>
val choose : chooser:('T -> 'U option) -> array:'T [] -> 'U []
<summary>Apply the given function to each element of the array. Return
the array comprised of the results "x" for each element where
the function returns Some(x).</summary>
<remarks>Performs the operation in parallel using <see cref="M:System.Threading.Tasks.Parallel.For" />.
The order in which the given function is applied to elements of the input array is not specified.</remarks>
<param name="chooser">The function to generate options from the elements.</param>
<param name="array">The input array.</param>
<returns>The array of results.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val xs : TextItemScreening
val itemOccurenceScores : Map<string,TextItemScreening>
val itemFrequencyScores : Map<string,TextItemScreening>
val toArray : table:Map<'Key,'T> -> ('Key * 'T) [] (requires comparison)
<summary>Returns an array of all key-value pairs in the mapping.
The array will be ordered by the keys of the map.</summary>
<param name="table">The input map.</param>
<returns>The array of key/value pairs.</returns>
val filter : predicate:('T -> bool) -> array:'T [] -> 'T []
<summary>Returns a new collection containing only the elements of the collection
for which the given predicate returns "true".</summary>
<param name="predicate">The function to test the input elements.</param>
<param name="array">The input array.</param>
<returns>An array containing the elements for which the given predicate returns true.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val xs : float
type Chart =
static member Area : x:seq<#IConvertible> * y:seq<#IConvertible> * ?Name:string * ?ShowMarkers:bool * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Dash:DrawingStyle * ?Width:float -> GenericChart + 1 overload
static member Bar : keys:seq<#IConvertible> * values:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Marker:Marker -> GenericChart + 1 overload
static member BoxPlot : ?x:'a0 * ?y:'a1 * ?Name:string * ?Showlegend:bool * ?Color:string * ?Fillcolor:'a2 * ?Opacity:float * ?Whiskerwidth:'a3 * ?Boxpoints:Boxpoints * ?Boxmean:BoxMean * ?Jitter:'a4 * ?Pointpos:'a5 * ?Orientation:Orientation * ?Marker:Marker * ?Line:Line * ?Alignmentgroup:'a6 * ?Offsetgroup:'a7 * ?Notched:bool * ?NotchWidth:float * ?QuartileMethod:QuartileMethod -> GenericChart + 1 overload
static member Bubble : x:seq<#IConvertible> * y:seq<#IConvertible> * sizes:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?StackGroup:string * ?Orientation:Orientation * ?GroupNorm:GroupNorm * ?UseWebGL:bool -> GenericChart + 1 overload
static member Candlestick : open:seq<#IConvertible> * high:seq<#IConvertible> * low:seq<#IConvertible> * close:seq<#IConvertible> * x:seq<#IConvertible> * ?Increasing:Line * ?Decreasing:Line * ?WhiskerWidth:float * ?Line:Line * ?XCalendar:Calendar -> GenericChart + 1 overload
static member ChoroplethMap : locations:seq<string> * z:seq<#IConvertible> * ?Text:seq<#IConvertible> * ?Locationmode:LocationFormat * ?Autocolorscale:bool * ?Colorscale:Colorscale * ?Colorbar:Colorbar * ?Marker:Marker * ?GeoJson:'a2 * ?FeatureIdKey:string * ?Zmin:float * ?Zmax:float -> GenericChart
static member ChoroplethMapbox : locations:seq<#IConvertible> * z:seq<#IConvertible> * geoJson:'a2 * ?FeatureIdKey:string * ?Text:seq<#IConvertible> * ?Below:string * ?Colorscale:Colorscale * ?Colorbar:Colorbar * ?ZAuto:bool * ?ZMin:float * ?ZMid:float * ?ZMax:float -> GenericChart
static member Column : keys:seq<#IConvertible> * values:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Marker:Marker -> GenericChart + 1 overload
static member Contour : data:seq<#seq<'a1>> * ?X:seq<#IConvertible> * ?Y:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Opacity:float * ?Colorscale:Colorscale * ?Showscale:'a4 * ?zSmooth:SmoothAlg * ?Colorbar:'a5 -> GenericChart (requires 'a1 :> IConvertible)
static member DensityMapbox : lon:seq<#IConvertible> * lat:seq<#IConvertible> * ?Z:seq<#IConvertible> * ?Radius:float * ?Opacity:float * ?Text:seq<#IConvertible> * ?Below:string * ?Colorscale:Colorscale * ?Colorbar:Colorbar * ?Showscale:bool * ?ZAuto:bool * ?ZMin:float * ?ZMid:float * ?ZMax:float -> GenericChart + 1 overload
...
<summary>
Provides a set of static methods for creating charts.
</summary>
static member Chart.Histogram : data:seq<#IConvertible> * ?Orientation:StyleParam.Orientation * ?Name:string * ?Showlegend:bool * ?Opacity:float * ?Color:string * ?HistNorm:StyleParam.HistNorm * ?HistFunc:StyleParam.HistNorm * ?nBinsx:int * ?nBinsy:int * ?Xbins:Bins * ?Ybins:Bins * ?xError:'a1 * ?yError:'a2 -> GenericChart.GenericChart
static member Chart.Show : ch:GenericChart.GenericChart -> unit
val getChargedItems : alphaLower:float -> alphaUpper:float -> kappaPct:float -> string []
Sentiment-charged words
val alphaLower : float
val alphaUpper : float
val kappaPct : float
val kappa : float
val upperThresh : float
val lowerThresh : float
val xs : Call []
val pieHat : float
val isCharged : (string -> string option)
val freqScore : TextItemScreening
val occScore : TextItemScreening
val choose : chooser:('T -> 'U option) -> array:'T [] -> 'U []
<summary>Applies the given function to each element of the array. Returns
the array comprised of the results "x" for each element where
the function returns Some(x)</summary>
<param name="chooser">The function to generate options from the elements.</param>
<param name="array">The input array.</param>
<returns>The array of results.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val chargedItems : string []
val filterCall : call:Call -> Call
val call : Call
type Call =
{ CallId: CallId
WordCount: WordCount []
Signal: float }
member Flag : Sentiment
val textItemsFromCall : Map<string,WordCount>
val filteredItemCounts : WordCount []
val chargedWord : string
val wordCount : WordCount
val sortBy : projection:('T -> 'Key) -> array:'T [] -> 'T [] (requires comparison)
<summary>Sorts the elements of an array, using the given projection for the keys and returning a new array.
Elements are compared using <see cref="M:Microsoft.FSharp.Core.Operators.compare" />.</summary>
<remarks>This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
For a stable sort, consider using <see cref="M:Microsoft.FSharp.Collections.SeqModule.Sort" />.</remarks>
<param name="projection">The function to transform array elements into the type that is compared.</param>
<param name="array">The input array.</param>
<returns>The sorted array.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
Call.CallId: CallId
val chargedTrain : Call []
val sumBy : projection:('T -> 'U) -> array:'T [] -> 'U (requires member ( + ) and member get_Zero)
<summary>Returns the sum of the results generated by applying the function to each element of the array.</summary>
<param name="projection">The function to transform the array elements into the type to be summed.</param>
<param name="array">The input array.</param>
<returns>The resulting sum.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val xs : int
val getDocumentTermMatrix : calls:Call [] -> Matrix<double>
val calls : Call []
Multiple items
val double : value:'T -> double (requires member op_Explicit)
<summary>Converts the argument to 64-bit float.</summary>
<remarks>This is a direct conversion for all
primitive numeric types. For strings, the input is converted using <c>Double.Parse()</c> with InvariantCulture settings. Otherwise the operation requires and invokes a <c>ToDouble</c> method on the input type.</remarks>
--------------------
[<Struct>]
type double = Double
<summary>An abbreviation for the CLI type <see cref="T:System.Double" />. Identical to <see cref="T:Microsoft.FSharp.Core.float" />.</summary>
<category>Basic Types</category>
--------------------
type double<'Measure> = float<'Measure>
<summary>The type of double-precision floating point numbers, annotated with a unit of measure.
The unit of measure is erased in compiled code and when values of this type
are analyzed using reflection. The type is representationally equivalent to
<see cref="T:System.Double" />.</summary>
<category index="6">Basic Types with Units of Measure</category>
val matrix : rowsSequences:#seq<'b> -> Matrix<'T> (requires 'b :> seq<'T> and default constructor and value type and 'T :> IEquatable<'T> and 'T :> IFormattable and 'T :> ValueType)
<summary>
Construct a dense matrix from a nested sequence of numbers.
</summary>
val xs : Matrix<double>
Matrix.Transpose() : Matrix<double>
Matrix.Transpose(result: Matrix<double>) : unit
val chargedDocumentTermMatrix : Matrix<double>
property Matrix.RowCount: int with get, set
<summary>
Gets the number of rows.
</summary>
<value>The number of rows.</value>
property Matrix.ColumnCount: int with get, set
<summary>
Gets the number of columns.
</summary>
<value>The number of columns.</value>
val bigH : Matrix<double>
val m : Matrix<double>
Matrix.ToColumnArrays() : double [] []
val itemCounts : double []
val sumOfItemCounts : double
val sum : array:'T [] -> 'T (requires member ( + ) and member get_Zero)
<summary>Returns the sum of the elements in the array.</summary>
<param name="array">The input array.</param>
<returns>The resulting sum.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val xs : double
val bigW : Matrix<double>
val n : double
val mapi : mapping:(int -> 'T -> 'U) -> array:'T [] -> 'U []
<summary>Builds a new array whose elements are the results of applying the given function
to each of the elements of the array. The integer index passed to the
function indicates the index of element being transformed.</summary>
<param name="mapping">The function to transform elements and their indices.</param>
<param name="array">The input array.</param>
<returns>The array of transformed elements.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val i : int
val xs : double []
val p : double
Matrix.Multiply(other: Matrix<double>) : Matrix<double>
Matrix.Multiply(rightSide: Vector<double>) : Vector<double>
Matrix.Multiply(scalar: double) : Matrix<double>
Matrix.Multiply(other: Matrix<double>, result: Matrix<double>) : unit
Matrix.Multiply(rightSide: Vector<double>, result: Vector<double>) : unit
Matrix.Multiply(scalar: double, result: Matrix<double>) : unit
val bigO : Matrix<float>
val h : Matrix<double>
val w : Matrix<double>
val w' : Matrix<double>
val ww' : Matrix<double>
Matrix.Inverse() : Matrix<double>
type Matrix<'T (requires default constructor and value type and 'T :> IEquatable<'T> and 'T :> IFormattable and 'T :> ValueType)> =
interface IFormattable
interface IEquatable<Matrix<'T>>
interface ICloneable
new : storage: MatrixStorage<'T> -> unit
member Add : scalar: 'T -> Matrix<'T> + 3 overloads
member Append : right: Matrix<'T> -> Matrix<'T> + 1 overload
member AsArray : unit -> 'T [,]
member AsColumnArrays : unit -> 'T [] []
member AsColumnMajorArray : unit -> 'T []
member AsRowArrays : unit -> 'T [] []
...
<summary>
Defines the base class for <c>Matrix</c> classes.
</summary>
<summary>
Defines the base class for <c>Matrix</c> classes.
</summary>
<typeparam name="T">Supported data types are <c>double</c>, <c>single</c>, <see cref="N:MathNet.Numerics.LinearAlgebra.Complex" />, and <see cref="N:MathNet.Numerics.LinearAlgebra.Complex32" />.</typeparam>
<summary>
Defines the base class for <c>Matrix</c> classes.
</summary>
<summary>
Defines the base class for <c>Matrix</c> classes.
</summary>
val toColArrays : m:#Matrix<'b> -> 'b [] [] (requires default constructor and value type and 'b :> IEquatable<'b> and 'b :> IFormattable and 'b :> ValueType)
<summary>
Transform a matrix into an array of column arrays.
</summary>
val col : double []
val onlyPositiveVals : float []
val norm : float
val m : Matrix<float>
Matrix.Transpose() : Matrix<float>
Matrix.Transpose(result: Matrix<float>) : unit
val bigOArr : float [] []
Matrix.ToRowArrays() : float [] []
val objF : call:Call -> p:float -> lambda:float -> float
val p : float
val lambda : float
val filteredCall : Call
val sHat : float
val pos : float
val neg : float
val d : float
val log : value:'T -> 'T (requires member Log)
<summary>Natural logarithm of the given number</summary>
<param name="value">The input value.</param>
<returns>The natural logarithm of the input.</returns>
val expr : float []
val computeScore : call:Call -> (float * float) * float
val scoreP : float
val maxBy : projection:('T -> 'U) -> array:'T [] -> 'T (requires comparison)
<summary>Returns the greatest of all elements of the array, compared via Operators.max on the function result.</summary>
<remarks>Throws ArgumentException for empty arrays.</remarks>
<param name="projection">The function to transform the elements into a type supporting comparison.</param>
<param name="array">The input array.</param>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
<exception cref="T:System.ArgumentException">Thrown when the input array is empty.</exception>
<returns>The maximum element.</returns>
val testHighSignals : ((float * float) * float) []
val take : count:int -> array:'T [] -> 'T []
<summary>Returns the first N elements of the array.</summary>
<remarks>Throws <c>InvalidOperationException</c>
if the count exceeds the number of elements in the array. <c>Array.truncate</c>
returns as many items as the array contains instead of throwing an exception.</remarks>
<param name="count">The number of items to take.</param>
<param name="array">The input array.</param>
<returns>The result array.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
<exception cref="T:System.ArgumentException">Thrown when the input array is empty.</exception>
<exception cref="T:System.InvalidOperationException">Thrown when count exceeds the number of elements
in the list.</exception>
val res : (float * float) * float
val testLowSignals : float
val averageBy : projection:('T -> 'U) -> array:'T [] -> 'U (requires member ( + ) and member DivideByInt and member get_Zero)
<summary>Returns the average of the elements generated by applying the function to each element of the array.</summary>
<param name="projection">The function to transform the array elements before averaging.</param>
<param name="array">The input array.</param>
<exception cref="T:System.ArgumentException">Thrown when <c>array</c> is empty.</exception>
<returns>The computed average.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val res : float * float
namespace DiffSharp
namespace DiffSharp.Optim
val computeScore' : call:Call -> x:Tensor -> Tensor
val x : Tensor
type Tensor =
private | TensorC of primalRaw: RawTensor
| TensorF of primal: Tensor * derivative: Tensor * nestingTag: uint32
| TensorR of primal: Tensor * derivative: Tensor ref * parentOp: TensorOp * fanout: uint32 ref * nestingTag: uint32
interface IConvertible
interface IComparable
override Equals : other:obj -> bool
override GetHashCode : unit -> int
member private GetSlice : bounds:int [,] -> Tensor
override ToString : unit -> string
member abs : unit -> Tensor
member acos : unit -> Tensor
member add : b:Tensor -> Tensor + 1 overload
member addSlice : location:seq<int> * b:Tensor -> Tensor
...
<summary>
Represents a multi-dimensional data type containing elements of a single data type.
</summary>
<example>
A tensor can be constructed from a list or sequence using <see cref="M:DiffSharp.dsharp.tensor(System.Object)" /><code>
let t = dsharp.tensor([[1.; -1.]; [1.; -1.]])
</code></example>
val scoreP : Tensor
val pos : Tensor
val neg : Tensor
val sumExpr : Tensor
val xs : Tensor
val lr : float
val momentum : float
val iters : int
val threshold : float
val scoreFun : (Tensor -> Tensor)
val scorePGuess : Tensor
type dsharp =
static member abs : input:Tensor -> Tensor
static member acos : input:Tensor -> Tensor
static member add : a:Tensor * b:Tensor -> Tensor
static member arange : endVal:float * ?startVal:float * ?step:float * ?dtype:Dtype * ?device:Device * ?backend:Backend -> Tensor + 1 overload
static member arangeLike : input:Tensor * endVal:float * ?startVal:float * ?step:float * ?dtype:Dtype * ?device:Device * ?backend:Backend -> Tensor + 1 overload
static member argmax : input:Tensor -> int []
static member argmin : input:Tensor -> int []
static member asin : input:Tensor -> Tensor
static member atan : input:Tensor -> Tensor
static member bceLoss : input:Tensor * target:Tensor * ?weight:Tensor * ?reduction:string -> Tensor
...
<summary>
Tensor operations
</summary>
static member dsharp.tensor : value:obj * ?dtype:Dtype * ?device:Device * ?backend:Backend -> Tensor
val scoreFx : Tensor
val params' : Tensor
type optim =
static member adam : f:(Tensor -> Tensor) * x0:Tensor * ?lr:Tensor * ?beta1:Tensor * ?beta2:Tensor * ?eps:Tensor * ?iters:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> Tensor * Tensor + 1 overload
static member private optimizeFun : update:(Tensor -> Tensor * Tensor) * x0:Tensor * ?iters:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> Tensor * Tensor
static member private optimizeModel : model:Model * optimizer:Optimizer * dataloader:DataLoader * loss:(Tensor -> Tensor -> Tensor) * ?iters:int * ?epochs:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> unit
static member sgd : f:(Tensor -> Tensor) * x0:Tensor * ?lr:Tensor * ?momentum:Tensor * ?nesterov:bool * ?iters:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> Tensor * Tensor + 1 overload
<summary>TBD</summary>
static member optim.sgd : f:(Tensor -> Tensor) * x0:Tensor * ?lr:Tensor * ?momentum:Tensor * ?nesterov:bool * ?iters:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> Tensor * Tensor
static member optim.sgd : model:Model.Model * dataloader:Data.DataLoader * loss:(Tensor -> Tensor -> Tensor) * ?lr:Tensor * ?momentum:Tensor * ?nesterov:bool * ?weightDecay:Tensor * ?reversible:bool * ?iters:int * ?epochs:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> unit