Single user-data processing

1. Install Begin’s Library

First, install Begin’s pip library by calling:
pip install beginai
This will initiate the installation process.
If using virtual environments, don’t forget to add beginai to the requirements.txt file as well.

2. Add Your Account Credentials

Next, open your Python editor and
  • import the library
  • initialize it with the app_id and license_key that you can find under your settings menu in your account.
import beginai as bg APP_ID = "APP_ID" LICENSE_KEY = "LICENSE_KEY" beginWorker = bg.BeginWorker(app_id=APP_ID, license_key=LICENSE_KEY)
Code sample of import command. Make sure to replace APP_ID and LICENSE_KEY with your ID and key.

Load Your Data

Now you’re good to load your users’ data for processing on your computer. Copy the code from your Integration Code page to your SDK
begin_worker.register_user('USER_ID') begin_worker.register_object('book', 'OBJECT_ID') begin_worker.start_session() begin_worker.update_object_numerical_field('book','OBJECT_ID', 'text_reviews_count', '...') begin_worker.update_object_text_field('book','OBJECT_ID', 'is_ebook', '...') begin_worker.update_object_numerical_field('book','OBJECT_ID', 'average_rating', '...') begin_worker.update_object_numerical_field('book','OBJECT_ID', 'num_pages', '...') begin_worker.update_object_text_field('book','OBJECT_ID', 'publication_month', '...') begin_worker.update_object_text_field('book','OBJECT_ID', 'publication_year', '...') begin_worker.update_object_numerical_field('book','OBJECT_ID', 'ratings_count', '...') begin_worker.update_object_numerical_field('book','OBJECT_ID', 'avg_author_rating', '...') begin_worker.update_object_numerical_field('book','OBJECT_ID', 'avg_author_reviews_count', '...') begin_worker.update_object_numerical_field('book','OBJECT_ID', 'sum_all_author_ratings', '...') begin_worker.update_object_text_field('book','OBJECT_ID', 'genre_1', '...') begin_worker.update_object_text_field('book','OBJECT_ID', 'genre_2', '...') begin_worker.update_object_text_field('book','OBJECT_ID', 'genre_3', '...') begin_worker.update_object_text_field('book','OBJECT_ID', 'genre_4', '...') begin_worker.register_interaction('USER_ID', 'book', 'is_read | is_reviewed | rated_0 | rated_1 | rated_2 | rated_3 | rated_4 | rated_5', 'OBJECT_ID') begin_worker.end_session()
☝️
DON’T FORGET! All fields and interactions must be defined in the schema before they are used in the SDK.
For more information what each field represents, refer to our field guide.
🌀
Field guide

Start Learning

Once you’ve loaded your data, the final step is to send the following call:
begin_worker.learn_from_data()
When you write learn from data, anonymized and secure signatures are generated and sent to Begin platform to initiate the machine learning process.
💡
RUNNING ON MULTIPLE PLATFORMS? You can process users from any SDK simultaneously. Once you make the above call, the system will merge the learnings across all platforms automatically.