Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #28 from IBM/ColumnProjection
Browse files Browse the repository at this point in the history
bump version; add test
  • Loading branch information
ppalmes authored May 20, 2021
2 parents f5bcfe4 + 4581f62 commit ce6555f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Lale"
uuid = "25676c37-aa2f-4f14-ad5b-b63670ababff"
authors = ["Paulito Palmes <[email protected]>", "Martin Hirzel", "Avraham Shinnar", "Kiran Kate"]
version = "0.1.5"
version = "0.1.6"

[deps]
AMLPipelineBase = "e3c3008a-8869-4d53-9f34-c96f99c8a2b6"
Expand All @@ -14,7 +14,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
AMLPipelineBase = "0.1"
DataFrames = "0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 1.0"
DataFrames = "0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 1.0, 1.1"
Pandas = "1.1, 1.2, 1.3, 1.4"
PyCall = "1.90, 1.91, 1.92"
julia = "1"
Expand Down
2 changes: 1 addition & 1 deletion demo/demo-lale-project.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ X = df[:,2:end]
train_X,train_y,test_X,test_y = Lale.train_test_split(X, y,testprop=0.20)

prep_to_numbers =
((stringprj >> OneHotEncoder(handle_unknown = "ignore")) & numericprj )>> ConcatFeatures
((strfeat >> OneHotEncoder(handle_unknown = "ignore")) & numfeat)>> ConcatFeatures
planned_orig = prep_to_numbers >> ( Tree | KNN)
lopt = LalePipeOptimizer(planned_orig,max_evals = 10,cv = 3)
laletrained = fit(lopt,train_X,train_y)
Expand Down
45 changes: 45 additions & 0 deletions test/test_project.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module TestProject

using DataFrames
using CSV
using Lale
using Test

function proj_test()

strfeat= laleoperator("Project","lale")(columns=Dict("type"=>"string"))
numfeat = laleoperator("Project","lale")(columns=Dict("type"=>"number"))

OneHotEncoder = laleoperator("OneHotEncoder")
ConcatFeatures = laleoperator("ConcatFeatures","lale")
Tree = laleoperator("DecisionTreeClassifier")
KNN = laleoperator("KNeighborsClassifier")
RF = laleoperator("RandomForestClassifier")
PCA = laleoperator("PCA")
Hyperopt = laleoperator("Hyperopt","lale")

df = CSV.read("./demo/old/credit.csv",DataFrame)
y = df[!,"class"] |> collect
X = df[:,2:end]

train_X,train_y,test_X,test_y = Lale.train_test_split(X, y,testprop=0.20)

prep_to_numbers =
((strfeat >> OneHotEncoder(handle_unknown = "ignore")) & numfeat )>> ConcatFeatures
planned_orig = prep_to_numbers >> ( Tree | KNN)
lopt = LalePipeOptimizer(planned_orig,max_evals = 3,cv = 3)
laletrained = fit(lopt,train_X,train_y)
lalepred = Lale.transform(laletrained,test_X)
@test score(:accuracy,lalepred,test_y) > 0.50

pca_tree_planned = prep_to_numbers >> PCA >> RF
lopt = LalePipeOptimizer(pca_tree_planned,max_evals = 3,cv = 3)
laletrained = fit(lopt,train_X,train_y)
lalepred = Lale.transform(laletrained,test_X)
@test score(:accuracy,lalepred,test_y) > 0.50
end
@testset "Lale Projection" begin
proj_test()
end

end

2 comments on commit ce6555f

@ppalmes
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/37132

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.6 -m "<description of version>" ce6555f66890963049c849062b6f5c8bd87d1291
git push origin v0.1.6

Please sign in to comment.