Python Client for Marlin Feature Store
Project description
Documentation
See the API Docs.
Installing
pip install marlinfs
Usage
Login
marlin.login()
Batch Ingestion
transform_client = marlin.transform_client(namespace, name, version, entities)
@transform_client.process_function
def process():
dep1 = transform_client.add_dependency('n1', 't1', 'v1', ['f1', 'f2'])
# Reading by timestamp
ingestion_time_read = dep1.read_by_ingestion_ts(1612140982, 1612150982)
event_time_read = dep1.read_by_event_ts(1612140982, 1612150982)
# Reading by date
ingestion_date_read = dep1.read_by_ingestion_date("2021-01-02-03", "2021-01-02-04")
event_date_read = dep1.read_by_event_date("2021-01-02-03", "2021-01-02-04")
# To commit metadata and store data
transform_client.commit()
# assumption is df contains event_timestamp column in date in this format: 2021-01-02-03.
# To pass different date format change return statement to df, {'date_format': 'str_date', 'str_date_format_type': '<python date format>' e.g. %Y-%m-%d})
# To pass event_timestamp in seconds change return statement to df, {'date_format': 'seconds'}
return df
Batch Serving
batch_serving_client = marlin.batch_training_client(namespace, name, version)
# batch_serving_client = marlin.batch_scoring_client(namespace, name, version)
@batch_serving_client.serving_function
def process():
entity_df = None # Some entity df
dep1 = batch_serving_client.add_dependency('n1', 't1', 'v1', ['f1', 'f2'])
dep2 = batch_serving_client.add_dependency('n2', 't1', 'v1', ['f1', 'f2'])
entity_df = pd.DataFrame([
[1, 1, 1, 1, "2021-01-02-03"],
[1, 1, 1, 1, "2021-01-02-03"]
], columns=['A', 'B', 'C', 'D', 'target_timestamp'])
dep1.point_in_time_join_by_date(entity_df)
dep1.point_in_time_join_across_inputs_by_date(entity_df, [dep2])
entity_df = pd.DataFrame([
[1, 1, 1, 1, 1612140982],
[1, 1, 1, 1, 1612140982]
], columns=['A', 'B', 'C', 'D', 'target_timestamp'])
dep1.point_in_time_join_by_ts(entity_df)
dep1.point_in_time_join_across_inputs_by_ts(entity_df, [dep2])
# To commit metadata
batch_serving_client.commit()
Exploration Client
exploration_client = marlin.exploration_client()
tf1 = exploration_client.get_transform('n1', 't1', 'v1')
tf2 = exploration_client.get_transform('n2', 't2', 'v1')
entity_df = pd.DataFrame([
[1, 1, 1, 1, "2021-01-02-03"],
[1, 1, 1, 1, "2021-01-02-03"]
], columns=['A', 'B', 'C', 'D', 'target_timestamp'])
tf1.point_in_time_join_by_date(entity_df)
tf1.point_in_time_join_across_inputs_by_date(entity_df, [tf2])
entity_df = pd.DataFrame([
[1, 1, 1, 1, 1612140982],
[1, 1, 1, 1, 1612140982]
], columns=['A', 'B', 'C', 'D', 'target_timestamp'])
tf1.point_in_time_join_by_ts(entity_df)
tf1.point_in_time_join_across_inputs_by_ts(entity_df, [tf2])
# Reading by timestamp
ingestion_time_read = tf1.read_by_ingestion_ts(1612140982, 1612150982)
event_time_read = tf1.read_by_event_ts(1612140982, 1612150982)
# Reading by date
ingestion_date_read = tf1.read_by_ingestion_date("2021-01-02-03", "2021-01-02-04")
event_date_read = tf1.read_by_event_date("2021-01-02-03", "2021-01-02-04")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
marlinfs-0.0.2.tar.gz
(23.8 kB
view details)
Built Distribution
File details
Details for the file marlinfs-0.0.2.tar.gz
.
File metadata
- Download URL: marlinfs-0.0.2.tar.gz
- Upload date:
- Size: 23.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 862255b379cbe9ca21499316c5fcf35d1a657e166de7bc3eaa8feb51a478c459 |
|
MD5 | 02973da56aaf0ce2e37d021425ec5e82 |
|
BLAKE2b-256 | f4832e325580411dc9d2f5166d195b87abb1d54895deb463078f64530b17aa5c |
File details
Details for the file marlinfs-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: marlinfs-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1929e1fd28a5287187776862a61ab772ccfb05c7ca88fd62ded356f836d2162d |
|
MD5 | dfca439b9023bda48fe7c2748651e9f1 |
|
BLAKE2b-256 | a2a1dd85c35b05028a9a54fa8e937b5512847bf9af4500db109ff51094d5d44e |