Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move machine learning code into utils class #1825

Closed
Tracked by #107
nya-elimu opened this issue Aug 20, 2024 · 4 comments · Fixed by #1919
Closed
Tracked by #107

Move machine learning code into utils class #1825

nya-elimu opened this issue Aug 20, 2024 · 4 comments · Fixed by #1919
Assignees
Labels
good first issue Good for newcomers

Comments

@nya-elimu
Copy link
Member

nya-elimu commented Aug 20, 2024

For better separation of concerns, move the code for calling the machine learning model from StoryBookCreateFromEPubController into its own utils class in a new ai.elimu.util.ml package. Also move the PMML file to src/main/resources/ai/elimu/util/ml, and add unit tests for covering the code in the new utils class.


@Aryant-Tripathi
Copy link
Contributor

@nya-elimu May I be allowed to pick this up?

@nya-elimu
Copy link
Member Author

@nya-elimu May I be allowed to pick this up?

@Aryant-Tripathi Please do! 🙂

@Aryant-Tripathi
Copy link
Contributor

Hey, @nya-elimu Method handleSubmit() contains I guess a legacy code of around 400 lines and involve multiple things in a single method. Do I need to refactor the method and try to extract some independent pieces which we can use in util file OR do i need to put method List<File> unzipFiles(byte[] ePubBytes, String originalFilename) into utility file only.

I guess refactoring the method into some smaller methods, and extracting things into utility files and fetching some data by making them environment variables would be helpful, but it seems it will take too much of effort and we need to create test cases for the same also.

@jo-elimu
Copy link
Member

jo-elimu commented Oct 21, 2024

@Aryant-Tripathi I think the task here would be to only move the code related to the machine learning model inference, i.e. the predictReadingLevel() method.

Aryant-Tripathi added a commit to Aryant-Tripathi/webapp that referenced this issue Oct 22, 2024
Aryant-Tripathi added a commit to Aryant-Tripathi/webapp that referenced this issue Oct 24, 2024
- Refactored `predictReadingLevel` method from core class into `PredictionUtils`
  to enhance reusability and separation of concerns.
- The utility class no longer includes logging statements.
- Add unit test cases for ReadingFileUtil class.
- Create a ReadingLevelConstants class which will be responsbile for containing all constants related to Reading level.

Issue elimu-ai#1825
Aryant-Tripathi added a commit to Aryant-Tripathi/webapp that referenced this issue Oct 24, 2024
- Refactored the predictReadingLevel method from core class into PredictionUtils to enhance reusability and separation of concerns.
- The utility class no longer includes logging statements, adhering to best practices.
- Added a ReadingLevelConstants class responsible for containing all constants related to the Reading Level ML model.
- Added unit test cases for ReadingLevelUtil class.

Issue elimu-ai#1825
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants