Measures
This page contains documentation for all measures found in this package.
JudiLingMeasures.ALC — MethodALC(cor_s::Union{JudiLing.SparseMatrixCSC, Matrix})Compute the Average Lexical Correlation (ALC) between the predicted vectors in Shat and all semantic vectors in S.
Arguments
s_cor::Union{JudiLing.SparseMatrixCSC, Matrix}: the correlation matrix between S and Shat
Examples
julia> Shat = [[1 2 1 1]; [1 -2 3 1]; [1 -2 3 3]; [0 0 1 2]]
julia> S = [[-1 2 1 1]; [1 2 3 1]; [1 2 0 1]; [0.5 -2 1.5 0]]
julia> acc, cor_s = JudiLing.eval_SC(Shat, S, R=true)
julia> ALC(cor_s)
4-element Vector{Float64}:
0.1867546970250672
-0.030901103469572838
-0.0681995247218424
0.011247813283240052JudiLingMeasures.ALDC — MethodALDC(df::DataFrame)Compute the Average Levenshtein Distance of all candidates (ALDC) with the correct word form.
Arguments
df::DataFrame: DataFrame of the output oflearn_paths.
JudiLingMeasures.EDNN — MethodEDNN(Shat::Union{JudiLing.SparseMatrixCSC, Matrix},
S::Union{JudiLing.SparseMatrixCSC, Matrix})Compute the Euclidean Distance nearest neighbours between the predicted semantic vectors in Shat and the semantic vectors in S.
Examples
Examples
julia> ma1 = [[1 2 3]; [-1 -2 -3]; [1 2 3]]
julia> ma4 = [[1 2 2]; [1 -2 -3]; [0 2 3]]
julia> EDNN(ma1, ma4)
3-element Vector{Float64}:
1.0
2.0
1.0JudiLingMeasures.L1Norm — MethodL1Norm(M::Union{JudiLing.SparseMatrixCSC, Matrix})Compute the L1 Norm of each row of a matrix.
Examples
julia> Shat = [[1 2 3]; [-1 -2 -3]; [1 2 3]]
julia> L1Norm(Shat)
3-element Vector{Int64}:
6
6
6JudiLingMeasures.L2Norm — MethodL2Norm(M::Union{JudiLing.SparseMatrixCSC, Matrix})Compute the L2 Norm of each row of a matrix.
Examples
julia> Shat = [[1 2 3]; [-1 -2 -3]; [1 2 3]]
julia> L2Norm(Shat)
3-element Vector{Float64}:
3.7416573867739413
3.7416573867739413
3.7416573867739413JudiLingMeasures.NNC — MethodNNC(cor_s::Union{JudiLing.SparseMatrixCSC, Matrix})For each predicted semantic vector get the highest correlation with the semantic vectors in S.
Arguments
s_cor::Union{JudiLing.SparseMatrixCSC, Matrix}: the correlation matrix between S and Shat
Examples
julia> Shat = [[1 2 1 1]; [1 -2 3 1]; [1 -2 3 3]; [0 0 1 2]]
julia> S = [[-1 2 1 1]; [1 2 3 1]; [1 2 0 1]; [0.5 -2 1.5 0]]
julia> acc, cor_s = JudiLing.eval_SC(Shat, S, R=true)
julia> NNC(cor_s)
4-element Vector{Float64}:
0.8164965809277259
0.9886230654859615
0.8625383733289683
0.35478743759344955JudiLingMeasures.SCPP — MethodSCPP(df::DataFrame, results::DataFrame)Semantic Correlation of Predicted Production. Returns the correlation of the predicted semantic vector of the predicted path with the target semantic vector.
Arguments
df::DataFrame: The output of learn_paths as DataFrame.results::DataFrame: The data of interest.
JudiLingMeasures.c_precision — Methodc_precision(c_hat_collection, cue_obj)Calculate the correlation between the predicted and the target cue vector.
Examples
julia> c = [[1. 1. 0.]; [0. 0. 1.]; [1. 0. 1.]]
julia> chat = [[0.9 0.9 0.1]; [0.9 0.1 1.]; [0.9 -0.1 0.8]]
julia> c_precision(chat, c)
3-element Array{Float64,1}:
1.0
0.5852057359806527
0.9958705948858222JudiLingMeasures.density — Methoddensity(cor_s::Union{JudiLing.SparseMatrixCSC, Matrix};
n::Int=8, ignore_missing::Bool=false)Compute the average correlation of each predicted semantic vector with its n most correlated neighbours.
Arguments
s_cor::Union{JudiLing.SparseMatrixCSC, Matrix}: the correlation matrix between S and Shatn::Int: the number of highest semantic neighbours to take into account
Example
julia> Shat = [[1 2 1 1]; [1 -2 3 1]; [1 -2 3 3]; [0 0 1 2]]
julia> S = [[-1 2 1 1]; [1 2 3 1]; [1 2 0 1]; [0.5 -2 1.5 0]]
julia> acc, cor_s = JudiLing.eval_SC(Shat, S, R=true)
julia> density(cor_s, n=2)
4-element Vector{Float64}:
0.7393813797301239
0.6420816485652429
0.4496869233815781
0.281150888376636JudiLingMeasures.last_support — Methodlast_support(cue_obj::JudiLing.Cue_Matrix_Struct,
Chat::Union{JudiLing.SparseMatrixCSC, Matrix})Return the support in Chat for the last ngram of each target word.
JudiLingMeasures.lwlr — Methodlwlr(res_learn, pred_df::DataFrame)The ratio between the predicted form's length and its weakest support from learn_paths.
Arguments
pred_df::DataFrame: The output ofget_predicted_path_support
JudiLingMeasures.lwlr_chat — Methodlwlr_chat(res_learn, Chat)The ratio between the predicted form's length and its weakest support in Chat.
JudiLingMeasures.mean_word_support — Methodmean_word_support(res_learn, pred_df::DataFrame)Compute the summed path support divided by each word form's length for each word in dat_val.
Arguments
res_learn: The output of learn_pathspred_df::DataFrame: The output ofget_predicted_path_support
JudiLingMeasures.mean_word_support_chat — Methodmean_word_support_chat(res_learn, Chat)Compute the summed path support, taken from Chat, divided by each word form's length for each word in dat_val.
JudiLingMeasures.path_counts — Methodpath_counts(df::DataFrame)Return the number of possible paths as returned by learn_paths.
Arguments
df::DataFrame: DataFrame of the output oflearn_paths.
JudiLingMeasures.path_entropies_chat — Methodpath_entropies_chat(res_learn,
Chat::Union{JudiLing.SparseMatrixCSC, Matrix})JudiLingMeasures.path_entropies_scp — Methodpath_entropes_scp(df::DataFrame)Computes the entropy over the semantic supports for all candidates per target word form.
Arguments
df::DataFrame: DataFrame of the output oflearn_paths.
JudiLingMeasures.path_sum — Methodpath_sum(pred_df::DataFrame)Compute the summed path support for each predicted word with highest support in dat_val.
Arguments
pred_df::DataFrame: The output ofget_predicted_path_support
JudiLingMeasures.path_sum_chat — Methodpath_sum_chat(res_learn,
Chat::Union{JudiLing.SparseMatrixCSC, Matrix})JudiLingMeasures.rank — Methodrank(cor_s::Union{JudiLing.SparseMatrixCSC, Matrix})Return the rank of the correct form among the comprehension candidates.
Arguments
s_cor::Union{JudiLing.SparseMatrixCSC, Matrix}: the correlation matrix between S and Shat
Examples
julia> Shat = [[1 2 1 1]; [1 -2 3 1]; [1 -2 3 3]; [0 0 1 2]]
julia> S = [[-1 2 1 1]; [1 2 3 1]; [1 2 0 1]; [0.5 -2 1.5 0]]
julia> acc, cor_s = JudiLing.eval_SC(Shat, S, R=true)
julia> rank(cor_s)
4-element Vector{Any}:
2
2
4
1JudiLingMeasures.recognition — Methodrecognition(data::DataFrame)Return a vector indicating whether a wordform was correctly understood. Not implemented.
JudiLingMeasures.semantic_support_for_form — Methodsemantic_support_for_form(cue_obj::JudiLing.Cue_Matrix_Struct,
Chat::Union{JudiLing.SparseMatrixCSC, Matrix})Return the support in Chat for all target ngrams of each target word.
JudiLingMeasures.target_correlation — Methodtarget_correlation(cor_s::Union{JudiLing.SparseMatrixCSC, Matrix})Calculate the correlation between each predicted semantic vector and its target semantic vector.
Arguments
s_cor::Union{JudiLing.SparseMatrixCSC, Matrix}: the correlation matrix between S and Shat
Examples
julia> Shat = [[1 2 1 1]; [1 -2 3 1]; [1 -2 3 3]; [0 0 1 2]]
julia> S = [[-1 2 1 1]; [1 2 3 1]; [1 2 0 1]; [0.5 -2 1.5 0]]
julia> acc, cor_s = JudiLing.eval_SC(Shat, S, R=true)
julia> target_correlation(cor_s)
4-element Vector{Float64}:
0.6622661785325219
0.2955402316445243
-0.86386842558136
0.35478743759344955JudiLingMeasures.target_path_sum — Methodtarget_path_sum(gpi)Compute the summed path support for each target word. Code by Yu-Ying Chuang.
JudiLingMeasures.within_path_entropies — Methodwithin_path_entropies(pred_df::DataFrame)Compute the Shannon Entropy of the path supports for each word in dat_val.
Arguments
pred_df::DataFrame: The output ofget_predicted_path_support