Skip to content

Commit d2c26f9

Browse files
committed
Merge branch 'dev'
2 parents 9cbb836 + adc8612 commit d2c26f9

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "JudiLing"
22
uuid = "b43a184b-0e9d-488b-813a-80fd5dbc9fd8"
33
authors = ["Xuefeng Luo"]
4-
version = "0.4.7"
4+
version = "0.4.8"
55

66
[deps]
77
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"

docs/src/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ Parameters for Cholesky mode are:
795795
- `shift::Float64 = 0.02`: shift value for :additive decomposition
796796
- `multiplier::Float64 = 1.01`: multiplier value for :multiplicative decomposition
797797
- `output_format::Symbol = :auto`: to force output format to dense(:dense) or sparse(:sparse), make it auto(:auto) to determined by the program
798-
- `sparse_ratio::Float64 = 0.2`: the ratio to decide whether a matrix is sparse
798+
- `sparse_ratio::Float64 = 0.05`: the ratio to decide whether a matrix is sparse
799799

800800
```julia
801801
JudiLing.test_combo(
@@ -812,7 +812,7 @@ JudiLing.test_combo(
812812
method = :additive,
813813
shift = 0.02,
814814
output_format = :auto,
815-
sparse_ratio = 0.2,
815+
sparse_ratio = 0.05,
816816
verbose = true
817817
)
818818
```

src/cholesky.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function make_transform_matrix(
7575
X::Union{SparseMatrixCSC,Matrix},
7676
Y::Union{SparseMatrixCSC,Matrix};
7777
output_format = :auto,
78-
sparse_ratio = 0.2,
78+
sparse_ratio = 0.05,
7979
verbose = false,
8080
)
8181

@@ -103,7 +103,7 @@ where X is a sparse matrix and Y is a dense matrix.
103103
- `shift::Float64 = 0.02`: shift value for :additive decomposition
104104
- `multiplier::Float64 = 1.01`: multiplier value for :multiplicative decomposition
105105
- `output_format::Symbol = :auto`: to force output format to dense(:dense) or sparse(:sparse), make it auto(:auto) to determined by the program
106-
- `sparse_ratio::Float64 = 0.2`: the ratio to decide whether a matrix is sparse
106+
- `sparse_ratio::Float64 = 0.05`: the ratio to decide whether a matrix is sparse
107107
- `verbose::Bool = false`: if true, more information will be printed out
108108
109109
# Examples
@@ -128,7 +128,7 @@ JudiLing.make_transform_matrix(
128128
JudiLing.make_transform_matrix(
129129
...
130130
output_format = :auto,
131-
sparse_ratio = 0.2,
131+
sparse_ratio = 0.05,
132132
...)
133133
```
134134
"""
@@ -139,7 +139,7 @@ function make_transform_matrix(
139139
shift = 0.02,
140140
multiplier = 1.01,
141141
output_format = :auto,
142-
sparse_ratio = 0.2,
142+
sparse_ratio = 0.05,
143143
verbose = false,
144144
)
145145

@@ -181,7 +181,7 @@ where X is a dense matrix and Y is either a dense matrix or a sparse matrix.
181181
- `shift::Float64 = 0.02`: shift value for :additive decomposition
182182
- `multiplier::Float64 = 1.01`: multiplier value for :multiplicative decomposition
183183
- `output_format::Symbol = :auto`: to force output format to dense(:dense) or sparse(:sparse), make it auto(:auto) to determined by the program
184-
- `sparse_ratio::Float64 = 0.2`: the ratio to decide whether a matrix is sparse
184+
- `sparse_ratio::Float64 = 0.05`: the ratio to decide whether a matrix is sparse
185185
- `verbose::Bool = false`: if true, more information will be printed out
186186
187187
# Examples
@@ -206,7 +206,7 @@ JudiLing.make_transform_matrix(
206206
JudiLing.make_transform_matrix(
207207
...
208208
output_format = :auto,
209-
sparse_ratio = 0.2,
209+
sparse_ratio = 0.05,
210210
...)
211211
```
212212
"""
@@ -217,7 +217,7 @@ function make_transform_matrix(
217217
shift = 0.02,
218218
multiplier = 1.01,
219219
output_format = :auto,
220-
sparse_ratio = 0.2,
220+
sparse_ratio = 0.05,
221221
verbose = false,
222222
)
223223

@@ -259,7 +259,7 @@ where X is a sparse matrix and Y is a sparse matrix.
259259
- `shift::Float64 = 0.02`: shift value for :additive decomposition
260260
- `multiplier::Float64 = 1.01`: multiplier value for :multiplicative decomposition
261261
- `output_format::Symbol = :auto`: to force output format to dense(:dense) or sparse(:sparse), make it auto(:auto) to determined by the program
262-
- `sparse_ratio::Float64 = 0.2`: the ratio to decide whether a matrix is sparse
262+
- `sparse_ratio::Float64 = 0.05`: the ratio to decide whether a matrix is sparse
263263
- `verbose::Bool = false`: if true, more information will be printed out
264264
265265
# Examples
@@ -284,7 +284,7 @@ JudiLing.make_transform_matrix(
284284
JudiLing.make_transform_matrix(
285285
...
286286
output_format = :auto,
287-
sparse_ratio = 0.2,
287+
sparse_ratio = 0.05,
288288
...)
289289
```
290290
"""
@@ -295,7 +295,7 @@ function make_transform_matrix(
295295
shift = 0.02,
296296
multiplier = 1.01,
297297
output_format = :auto,
298-
sparse_ratio = 0.2,
298+
sparse_ratio = 0.05,
299299
verbose = false,
300300
)
301301

@@ -332,7 +332,7 @@ Convert output matrix format to either a dense matrix or a sparse matrix.
332332
function format_matrix(
333333
M::Union{SparseMatrixCSC,Matrix},
334334
output_format = :auto;
335-
sparse_ratio = 0.2,
335+
sparse_ratio = 0.05,
336336
verbose = false,
337337
)
338338

src/find_path.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ word, which n-grams are best supported for a given position in the sequence of n
6767
- `target_col::Union{String, :Symbol}=:Words`: the column name for target strings
6868
- `start_end_token::Union{String, Char}="#"`: start and end token in boundary cues
6969
- `issparse::Symbol=:auto`: control of whether output of Mt matrix is a dense matrix or a sparse matrix
70-
- `sparse_ratio::Float64=0.2`: the ratio to decide whether a matrix is sparse
70+
- `sparse_ratio::Float64=0.05`: the ratio to decide whether a matrix is sparse
7171
- `if_pca::Bool=false`: turn on to enable pca mode
7272
- `pca_eval_M::Matrix=nothing`: pass original F for pca mode
7373
- `verbose::Bool=false`: if true, more information is printed
@@ -160,7 +160,7 @@ check_gold_path=true,
160160
res_val = JudiLing.learn_paths(
161161
...
162162
issparse=:auto,
163-
sparse_ratio=0.2,
163+
sparse_ratio=0.05,
164164
...)
165165
166166
# pca mode
@@ -217,7 +217,7 @@ function learn_paths(
217217
target_col = "Words",
218218
start_end_token = "#",
219219
issparse = :auto,
220-
sparse_ratio = 0.2,
220+
sparse_ratio = 0.05,
221221
if_pca = false,
222222
pca_eval_M = nothing,
223223
verbose = false,

src/test_combo.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,6 @@ function test_combo(test_mode; kwargs...)
237237
start_end_token,
238238
if_combined,
239239
verbose)
240-
for i in 1:10
241-
display(cue_obj_train.i2f[i])
242-
display(cue_obj_val.i2f[i])
243-
end
244240

245241
verbose && println("="^20)
246242
verbose && println("Making S matrix...")
@@ -502,8 +498,13 @@ function test_combo(test_mode; kwargs...)
502498
acc_Shat_train_homo = eval_SC(Shat_train, S_train, data_train, n_grams_target_col)
503499

504500
acc_Chat_val = eval_SC(Chat_val, cue_obj_val.C)
501+
acc_Chat_val_tv = eval_SC(Chat_val, cue_obj_val.C, cue_obj_train.C)
502+
505503
acc_Shat_val = eval_SC(Shat_val, S_val)
504+
acc_Shat_val_tv = eval_SC(Shat_val, S_val, S_train)
505+
506506
acc_Shat_val_homo = eval_SC(Shat_val, S_val, data_val, n_grams_target_col)
507+
acc_Shat_val_homo_tv = eval_SC(Shat_val, S_val, S_train, data_val, data_train, n_grams_target_col)
507508

508509
acc_learn_train = JudiLing.eval_acc(
509510
res_learn_train,
@@ -541,8 +542,11 @@ function test_combo(test_mode; kwargs...)
541542
println(accio, "Acc for Shat train: $acc_Shat_train")
542543
println(accio, "Acc for Shat train homophones: $acc_Shat_train_homo")
543544
println(accio, "Acc for Chat val: $acc_Chat_val")
545+
println(accio, "Acc for Chat val for both train and val: $acc_Chat_val_tv")
544546
println(accio, "Acc for Shat val: $acc_Shat_val")
547+
println(accio, "Acc for Acc for Shat val for both train and val: $acc_Shat_val_tv")
545548
println(accio, "Acc for Shat val homophones: $acc_Shat_val_homo")
549+
println(accio, "Acc for Shat val homophones for both train and val: $acc_Shat_val_homo_tv")
546550
println(accio, "Acc for learn_path train: $acc_learn_train")
547551
println(accio, "Acc for learn_path val: $acc_learn_val")
548552
println(accio, "Acc for build_path train: $acc_build_train")

0 commit comments

Comments
 (0)