Creating python ML package

Hello,
I am trying to upload an ML package written in Python, but I am new to python and I have no prior experience.
when I checked UIPath documentation in the link, it is written that the requirements for this package:

  1. In this file, a class called Main that implements at least two functions:
    a. init(self): takes no argument and loads your model and/or local data for the model (e.g. word embeddings).
    b. predict(self, input): a function to be called at model serving time.
  2. A file named requirements.txt with dependencies needed to run the model.

can anyone please help me how to transform my code below in order to comply with these requirements? and if there are any suggestions about the model ?

thanks

from sklearn.svm import OneClassSVM
import pandas as pd
from sklearn import preprocessing

input_file = "training.csv"
training_data = pd.read_csv(input_file)

X = training_data[['h1', 'h2', 'h3']].values

le = preprocessing.LabelEncoder()
for i in range(len(X[0])):
    X[:, i] =le.fit_transform(X[:,i])

model = OneClassSVM(gamma='auto').fit(X)
predection = model.predict(X)
print(predection)
1 Like

Hello @hani_mn91!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly
Forum_Staff

Apologies, no extra help from me, just exploring this myself and wondering if you managed to get anywhere?

Hi all
Have you checked this page: Building ML Packages

Jeremy

1 Like