Skip to content

Commit

Permalink
multilingual API docs + simplified code
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinvanschoren committed Nov 7, 2023
1 parent 245ab4c commit 14bef2d
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 208 deletions.
47 changes: 46 additions & 1 deletion app/public/locales/en/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,49 @@ terms:
### Consent
By using our website, you hereby consent to our Privacy Policy and agree to its terms.
apis:
helmet: "APIs"
helmet: "APIs"
api: "API"
outro_1: "You are learning fast, young apprentice!"
outro_2: "Still, there is so much more to see..."
docs_link: "Full Documentation"
guide_link: "See the complete guide"
copied: "Copied to clipboard."
others_header: "Other APIs"
tabs:
python: "Python"
r: "R"
java: "Java"
julia: "Julia"
others: "Others"
rest: "REST"
code_examples:
python:
installation: "Installation"
data: "Query and download data"
run: "Download tasks, run models locally, publish results (with scikit-learn)"
benchmark: "OpenML Benchmarks"
r:
installation: "Installation"
data: "Query and download data"
run: "Run an mlr3 model locally"
benchmark: "OpenML Benchmarks"
julia:
installation: "Installation"
data: "Query and download data"
java:
installation: "Installation"
data: "Query and download data"
run: "Download tasks, run models locally, publish results (with WEKA)"
benchmark: "OpenML Benchmarks"
others_card:
title: "Third-party bindings"
text: >
These are all APIs developed and maintained independently by amazing community members.
We can't offer any guarantees, but hope they might be useful to you.
items:
- "RUST"
- ".NET"
- "Command line"
tooltip:
colab: "Run in Google Colab"
copy: "Copy to clipboard"
9 changes: 7 additions & 2 deletions app/src/components/navbar/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,16 @@ const SearchContainer = ({ ecolor }) => {
);
};

const SubToolbar = styled(Toolbar)`
border-bottom: 1px solid rgba(255, 255, 255, 0.12);
border-top: 1px solid rgba(255, 255, 255, 0.12);
`;

const SearchMiniBar = ({ ecolor }) => {
return (
<Toolbar>
<SubToolbar>
<SearchContainer ecolor={ecolor} />
</Toolbar>
</SubToolbar>
);
};

Expand Down
8 changes: 4 additions & 4 deletions app/src/components/pages/apis/javaCodeExamples.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Installation
export const InstallationExample = `// Download the jar file, or install via Maven. See the full docs.`;
export const installation = `// Download the jar file, or install via Maven. See the full docs.`;

// Query and download data
export const DataExample = `// Create a client. Your API key can be found in your account.
export const data = `// Create a client. Your API key can be found in your account.
OpenmlConnector openml = new OpenmlConnector("api_key");
// List all datasets and their properties
Expand All @@ -13,7 +13,7 @@ DataSetDescription data = openml.dataGet(40996);
String file_url = data.getUrl();`;

// Run and publish models
export const RunExample = `// Build any model you like
export const run = `// Build any model you like
Classifier model = new RandomForest();
// Download any OpenML task
Expand All @@ -26,7 +26,7 @@ Instances d = InstancesHelper.getDatasetFromTask(openml, t);
Pair<Integer, Run> result = RunOpenmlJob.executeTask(openml, new WekaConfig(), 3954, model);`;

// Using Benchmarks
export const BenchmarkExample = `// List all tasks in a benchmark
export const benchmark = `// List all tasks in a benchmark
Study benchmark = openml.studyGet("OpenML-CC18", "tasks");
Task[] tasks = benchmark.getTasks()
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/pages/apis/juliaCodeExamples.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Installation
export const InstallationExample = `using Pkg
export const installation = `using Pkg
Pkg.add("OpenML")`;

// Query and download data
export const DataExample = `using OpenML
export const data = `using OpenML
using DataFrames
# List all datasets and their properties
Expand Down
8 changes: 4 additions & 4 deletions app/src/components/pages/apis/pythonCodeExamples.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Installation
export const InstallationExample = `pip install openml`;
export const installation = `pip install openml`;

// Query and download data
export const DataExample = `import openml
export const data = `import openml
# List all datasets and their properties
openml.datasets.list_datasets(output_format="dataframe")
Expand All @@ -17,7 +17,7 @@ dataset = openml.datasets.get_dataset('Fashion-MNIST')
X, y, _, _ = dataset.get_data(dataset_format="dataframe")`;

// Run and publish models
export const RunExample = `from sklearn import ensemble
export const run = `from sklearn import ensemble
from openml import tasks, runs
# Build any model you like
Expand All @@ -34,7 +34,7 @@ run = runs.run_model_on_task(clf, task)
run.publish()`;

// Using Benchmarks
export const BenchmarkExample = `# List all tasks in a benchmark
export const benchmark = `# List all tasks in a benchmark
benchmark = openml.study.get_suite('OpenML-CC18')
tasks.list_tasks(output_format="dataframe", task_id=benchmark.tasks)
Expand Down
8 changes: 4 additions & 4 deletions app/src/components/pages/apis/rCodeExamples.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Installation
export const InstallationExample = `# Note: The old OpenML package is superseded by the mlr3oml package.
export const installation = `# Note: The old OpenML package is superseded by the mlr3oml package.
# The documentation of the OpenML package can be found here: http://openml.github.io/openml-r/.
install.packages("mlr3oml")`;

// Query and download data
export const DataExample = `library(mlr3oml)
export const data = `library(mlr3oml)
library(mlr3)
# Search for specific datasets
Expand All @@ -23,7 +23,7 @@ odata$data
tsk_adult = as_task(odata, target = "class")`;

// Run and publish models
export const RunExample = `# create an mlr3 Learner and Resampling and run a resample experiment
export const run = `# create an mlr3 Learner and Resampling and run a resample experiment
rr = resample(
task = tsk_adult,
Expand All @@ -32,7 +32,7 @@ rr = resample(
)`;

// Using Benchmarks
export const BenchmarkExample = `# Access a Benchmark Suite
export const benchmark = `# Access a Benchmark Suite
ocollection = ocl(353)
# The IDs
Expand Down
Loading

0 comments on commit 14bef2d

Please sign in to comment.