Skip to content

Commit

Permalink
minor tings
Browse files Browse the repository at this point in the history
  • Loading branch information
pat-alt committed Jan 9, 2025
1 parent a04e3f9 commit 01ff1c0
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options
style = "blue"
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
version:
- '1.10'
- 'pre'
- '1'
os:
- ubuntu-latest
arch:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Format Check

on:
push:
branches:
- 'main'
- 'release-'
tags: '*'
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: 1
- uses: actions/checkout@v1
- name: Install JuliaFormatter
run: |
using Pkg
Pkg.add("JuliaFormatter")
shell: julia --color=yes {0}
- name: Format code
run: |
using JuliaFormatter
format("."; verbose=true)
shell: julia --color=yes {0}
- name: Check for formatting errors
shell: bash
run: |
output=$(git diff --name-only)
if [ "$output" != "" ]; then
>&2 echo "Some files have not been formatted !!!"
echo "$output"
exit 1
fi
9 changes: 2 additions & 7 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ makedocs(;
edit_link="master",
assets=String[],
),
pages=[
"Home" => "index.md",
],
pages=["Home" => "index.md"],
)

deploydocs(;
repo="github.com/JuliaTrustworthyAI/TaijaData.jl",
devbranch="master",
)
deploydocs(; repo="github.com/JuliaTrustworthyAI/TaijaData.jl", devbranch="master")
2 changes: 1 addition & 1 deletion src/synthetic/blobs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ function load_blobs(n=250; seed=data_seed, k=2, centers=2, kwrgs...)
X, y = MLJBase.make_blobs(n, k; centers=centers, rng=seed, kwrgs...)
X = permutedims(MLJBase.matrix(X))
y = DataAPI.unwrap.(y)

return (X, y)
end
2 changes: 1 addition & 1 deletion src/tabular/california_housing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ function load_california_housing(n::Union{Nothing,Int}=5000)
if !isnothing(n)
X, y = subsample(X, y, n)
end

return (X, y)
end
2 changes: 1 addition & 1 deletion src/tabular/credit_default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function load_credit_default(n::Union{Nothing,Int}=5000)
df.SEX = MLJBase.categorical(df.SEX)
df.EDUCATION = MLJBase.categorical(df.EDUCATION)
df.MARRIAGE = MLJBase.categorical(df.MARRIAGE)
transformer = MLJModels.Standardizer(; count=true) |> MLJModels.ContinuousEncoder()
transformer = MLJModels.ContinuousEncoder()(MLJModels.Standardizer(; count=true))
mach = MLJBase.fit!(MLJBase.machine(transformer, df[:, DataFrames.Not(:target)]))
X = MLJBase.transform(mach, df[:, DataFrames.Not(:target)])
X = permutedims(Matrix(X))
Expand Down
2 changes: 1 addition & 1 deletion src/tabular/german_credit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function load_german_credit(n::Union{Nothing,Int}=nothing)
X = permutedims(X)

# Counterfactual data:
y = convert(Vector,df.target)
y = convert(Vector, df.target)

# Undersample:
if !isnothing(n)
Expand Down
1 change: 0 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ function subsample(X::AbstractMatrix, y::AbstractVector, n::Int)
y = y[idx]

return (X, y)

end
2 changes: 1 addition & 1 deletion src/vision/cifar_10.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function load_cifar_10(n::Union{Nothing,Int}=nothing)
if !isnothing(n)
X, y = subsample(X, y, n)
end

return (X, y)
end

Expand Down
21 changes: 10 additions & 11 deletions test/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ end
@test size(dataset[1])[2] == 1000 # replace ... with actual size of your data
end
end

@testset "load_synthetic_data tests" begin
# Test dropping a specific dataset
data = TaijaData.load_synthetic_data(; drop=:linearly_separable)
@test !haskey(data, :linearly_separable)

# Test loading with specified number of samples
data = TaijaData.load_synthetic_data(500)
for dataset in values(data)
@test size(dataset[1])[2] == 500 # replace ... with actual size of your data
end
# Test dropping a specific dataset
data = TaijaData.load_synthetic_data(; drop=:linearly_separable)
@test !haskey(data, :linearly_separable)

# Test loading with specified number of samples
data = TaijaData.load_synthetic_data(500)
for dataset in values(data)
@test size(dataset[1])[2] == 500 # replace ... with actual size of your data
end
end
end

2 changes: 1 addition & 1 deletion test/tabular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using TaijaData
@testset "Check output types and sizes" begin
result = load_california_housing(100)

@test isa(result, Tuple{Matrix, Vector})
@test isa(result, Tuple{Matrix,Vector})

@test size(result[1], 2) == 100 # there should be 100 observations

Expand Down

0 comments on commit 01ff1c0

Please sign in to comment.