From a2e46fefd6868a6afc5ad07db3bbfdec93d15ca8 Mon Sep 17 00:00:00 2001 From: "Eric S. Tellez" Date: Thu, 5 May 2022 07:41:48 -0500 Subject: [PATCH] uses StatsAPI; nothing as parameter in mutate --- Project.toml | 6 ++++-- src/TextClassification.jl | 1 + src/textmodelspace.jl | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index f42b426..0850119 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TextClassification" uuid = "8e067cb0-742a-4f90-93f9-f1fa01b385ec" authors = ["Eric S. Tellez "] -version = "0.5.1" +version = "0.5.2" [deps] CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597" @@ -16,18 +16,20 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SearchModels = "0e966ebe-b704-4a65-8279-db954bfe5da0" SimilaritySearch = "053f045d-5466-53fd-b400-a066f88fe02a" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +StatsAPI = "82ae8749-77ed-4fe6-ae5f-f523153014b0" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" TextSearch = "7f6f6c8a-3b03-11e9-223d-e7d88259bd6c" [compat] CategoricalArrays = "0.8, 0.9, 0.10" -KNearestCenters = "0.7" InvertedFiles = "0.3" +KNearestCenters = "0.7" LIBLINEAR = "0.6.0" MLDataUtils = "0.5.0" Parameters = "0.12" SearchModels = "0.3" SimilaritySearch = "0.8" StatsBase = "0.32.0, 0.33" +StatsAPI = "1.2, 1.3" TextSearch = "0.11" julia = "1.6" diff --git a/src/TextClassification.jl b/src/TextClassification.jl index 86bd396..18523eb 100644 --- a/src/TextClassification.jl +++ b/src/TextClassification.jl @@ -1,6 +1,7 @@ # This file is part of TextClassification.jl module TextClassification +import StatsAPI: predict, fit using SimilaritySearch, TextSearch, SearchModels import SearchModels: combine, combine_select, mutate, config_type using Parameters, CategoricalArrays, InvertedFiles diff --git a/src/textmodelspace.jl b/src/textmodelspace.jl index 770e92a..4d8d20e 100644 --- a/src/textmodelspace.jl +++ b/src/textmodelspace.jl @@ -107,8 +107,8 @@ function combine(a::VectorModelConfig, b::VectorModelConfig) end function mutate(space::VectorModelConfigSpace, c::VectorModelConfig, iter) - mindocs = SearchModels.scale(c.mindocs; space.scale_mindocs...) - keeptop = SearchModels.scale(c.keeptop; space.scale_keeptop...) + mindocs = space.scale_mindocs === nothing ? c.mindocs : SearchModels.scale(c.mindocs; space.scale_mindocs...) + keeptop = space.scale_keeptop === nothing ? c.keeptop : SearchModels.scale(c.keeptop; space.scale_keeptop...) lw = SearchModels.change(c.local_weighting, space.local_weighting, p1=0.3) gw = SearchModels.change(c.global_weighting, space.global_weighting, p1=0.3)