NiaAML icon indicating copy to clipboard operation
NiaAML copied to clipboard

Provide CLI for easier interaction with NiaAML

Open firefly-cpp opened this issue 1 year ago • 1 comments

firefly-cpp avatar Apr 05 '24 15:04 firefly-cpp

I've just submitted a Pull Request (#92) as a draft version for the enhancement of the NiaAML library with a new command-line interface. This preliminary version introduces several basic commands (load_data, setup_classifier, and optimize_pipeline) to interact with the library's functionalities through a CLI.

It's important to note that this submission is a draft version. Due to certain constraints, I am unable to continue with the full implementation at this time. The current version lays down the foundational structure and demonstrates the basic concept. However, it requires further development and refinement to reach its full potential.

I believe this feature could greatly enhance the usability and accessibility of NiaAML, and I encourage other developers to contribute to its completion. Your expertise and contributions can help bring this initial idea to fruition, shaping it into a robust and user-friendly feature.

If you have ideas, improvements, or the capacity to develop this feature further, please feel free to build upon this initial draft. Any input or contributions are highly welcome, and I'm looking forward to seeing how this evolves with the community's collaborative efforts.

sisco0 avatar Apr 10 '24 06:04 sisco0

I was not aware that there is an interpreter feature in pythons cmd module 🤓

The idea of a shell is interesting, but a bit unconventional. The package API is already very simple. There is little to no logic to perfrom, its mainly:

  1. load dataset
  2. optimize pipeline
  3. save pipeline
  4. (optional) apply optimized pipeline to new/test data

Given that a user always performs these actions in order, I woulld consider simplifying the proposal to a command line tool with just two commands optimize and infer.

For such tools, I can recommend the very modern tool typer.

If you want @firefly-cpp , I could propose such a CLI script.

LaurenzBeck avatar Apr 23 '24 10:04 LaurenzBeck

Good idea! Please proceed with the "typer".

firefly-cpp avatar Apr 23 '24 11:04 firefly-cpp

I will create a CLI tool in the following days :)

LaurenzBeck avatar Jun 11 '24 11:06 LaurenzBeck

I misunderstood the purpose of the current issue. Thank you for bringing light into the topic @LaurenzBeck .

Considering the fact that typer would be used, it should be good to know what would be the commands like, so the new Pull Request could grab these ideas. An example would be something like:

python niaaml_cli.py optimize --dataset-path path/to/dataset.csv --dataset-with-header --dataset-with-classes --output-pipeline-path path/to/save/pipeline.pkl
python niaaml_cli.py infer --pipeline-path path/to/saved/pipeline.pkl --test-data-path path/to/test/data.csv --output-predictions-path path/to/save/predictions.txt

I would let the Pull Request to be created by @LaurenzBeck and would give my best effort at assistance if required.

sisco0 avatar Jun 11 '24 17:06 sisco0

I finished a prototype yesterday evening. I tried to stick to the original argument and keyword argument names as close as possible.

If you want to modify the names (or any other part of the interface), this should be all configurable by typer (mostly by using special typer type annotations instead of the simple python ones).

Since I also have to prepare the final presentation for the project warp-up for next monday, I will finish the PR today. I will be available for questions and (and maybe contributions) after the seminar ;)

Thanks to both of you @sisco0 and @firefly-cpp for your warm and welcoming support 🙏

here are some screenshots of the CLI interface: grafik grafik grafik

and an example usage of optimize: grafik

I added the following section to the pyproject.toml file, which will install the niaaml cli when one installs the package with pip or poetry:

[tool.poetry.scripts]
niaaml = "niaaml.cli:main"

LaurenzBeck avatar Jun 12 '24 06:06 LaurenzBeck