Skip to content

Commit 28930d4

Browse files
Fix example in docs, match docs with README, add downgrade check (#31)
* Fix example in docs, match docs with README, add downgrade check * revert arch change
1 parent 6d6ff0f commit 28930d4

File tree

6 files changed

+112
-10
lines changed

6 files changed

+112
-10
lines changed

.github/workflows/Downgrade.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Downgrade
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- 'docs/**'
8+
push:
9+
branches:
10+
- main
11+
paths-ignore:
12+
- 'docs/**'
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
version: ['1']
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: julia-actions/setup-julia@v1
22+
with:
23+
version: ${{ matrix.version }}
24+
- uses: cjdoris/julia-downgrade-compat-action@v1
25+
with:
26+
skip: Pkg,TOML
27+
- uses: julia-actions/julia-buildpkg@v1
28+
- uses: julia-actions/julia-runtest@v1

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
Documentation:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- uses: julia-actions/setup-julia@latest
2323
with:
2424
version: 1.6 # earliest supported version

.github/workflows/format_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: julia-actions/setup-julia@latest
1717
with:
1818
version: 1.6.0
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- name: Instantiate `format` environment and format
2121
run: |
2222
julia --project=format -e 'using Pkg; Pkg.instantiate()'

Project.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CatBoost"
22
uuid = "e2e10f9a-a85d-4fa9-b6b2-639a32100a12"
33
authors = ["Beacon Biosignals, Inc."]
4-
version = "0.3.3"
4+
version = "0.3.4"
55

66
[deps]
77
MLJModelInterface = "e80e1ace-859a-464e-9ed9-23947d8ae3ea"
@@ -10,14 +10,14 @@ PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
1010
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
1111

1212
[compat]
13-
Aqua = "0.8"
13+
Aqua = "0.8.4"
1414
DataFrames = "1.6"
1515
MLJBase = "1"
16-
MLJModelInterface = "1"
17-
MLJTestInterface = "0.2"
18-
OrderedCollections = "1.4"
16+
MLJModelInterface = "1.7"
17+
MLJTestInterface = "0.2.6"
18+
OrderedCollections = "1.6"
1919
PythonCall = "0.9"
20-
Tables = "1.4"
20+
Tables = "1.10"
2121
Test = "1.6"
2222
julia = "1.6"
2323

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,21 @@
88
[codecov-url]: https://codecov.io/github/JuliaAI/CatBoost.jl
99

1010

11-
Julia interface to [CatBoost](https://catboost.ai/).
11+
Julia interface to [CatBoost](https://catboost.ai/). This library is a wrapper CatBoost's Python package via [PythonCall.jl](https://github.com/cjdoris/PythonCall.jl).
12+
13+
For a nice introduction to the package, see the [examples](https://github.com/JuliaAI/CatBoost.jl/blob/main/examples/).
14+
15+
# Installation
16+
17+
This package is available in the Julia General Registry. You can install it with either of the following commands:
18+
19+
```
20+
pkg> add CatBoost
21+
```
22+
23+
```julia
24+
julia> using Pkg; Pkg.add("CatBoost")
25+
```
1226

1327
## Example
1428

@@ -38,7 +52,7 @@ end # module
3852
```julia
3953
module Regression
4054

41-
using CatBoost
55+
using CatBoost.MLJCatBoostInterface
4256
using DataFrames
4357
using MLJBase
4458

docs/src/index.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,63 @@ pkg> add CatBoost
1515
```julia
1616
julia> using Pkg; Pkg.add("CatBoost")
1717
```
18+
19+
## Example
20+
21+
```julia
22+
module Regression
23+
24+
using CatBoost
25+
using PythonCall
26+
27+
train_data = PyList([[1, 4, 5, 6], [4, 5, 6, 7], [30, 40, 50, 60]])
28+
eval_data = PyList([[2, 4, 6, 8], [1, 4, 50, 60]])
29+
train_labels = PyList([10, 20, 30])
30+
31+
# Initialize CatBoostRegressor
32+
model = CatBoostRegressor(iterations = 2, learning_rate = 1, depth = 2)
33+
34+
# Fit model
35+
fit!(model, train_data, train_labels)
36+
37+
# Get predictions
38+
preds = predict(model, eval_data)
39+
40+
end # module
41+
```
42+
43+
## MLJ Example
44+
```julia
45+
module Regression
46+
47+
using CatBoost.MLJCatBoostInterface
48+
using DataFrames
49+
using MLJBase
50+
51+
train_data = DataFrame([[1,4,30], [4,5,40], [5,6,50], [6,7,60]], :auto)
52+
eval_data = DataFrame([[2,1], [4,4], [6,50], [8,60]], :auto)
53+
train_labels = [10.0, 20.0, 30.0]
54+
55+
# Initialize MLJ Machine
56+
model = CatBoostRegressor(iterations = 2, learning_rate = 1, depth = 2)
57+
mach = machine(model, train_data, train_labels)
58+
59+
# Fit model
60+
MLJBase.fit!(mach)
61+
62+
# Get predictions
63+
preds = predict(model, eval_data)
64+
65+
end # module
66+
```
67+
68+
# Restricting Python catboost version
69+
70+
By default, `CatBoost.jl` installs the latest compatible version of `catboost` (version `>=1.1`) in your current `CondaPkg.jl` environment. To install a specific version, create a `CondaPkg.toml` file using `CondaPkg.jl`. Below is an example for specifying `catboost` version `v1.1`:
71+
72+
```julia
73+
using CondaPkg
74+
CondaPkg.add("catboost"; version="=1.1")
75+
```
76+
77+
This will create a `CondaPkg.toml` file in your current envrionment with the restricted `catboost` version. For more information on managing Conda environments with `CondaPkg.jl`, refer to the [official documentation](https://github.com/cjdoris/CondaPkg.jl).

0 commit comments

Comments
 (0)