<jupyter_start><jupyter_text>Install Pre-requisites<jupyter_code>!pip install -i https://test.pypi.org/simple/ arangomlFeatureStore
!pip install  pyArango python-arango PyYAML==5.2<jupyter_output><empty_output><jupyter_text>Add Package Path to Search Path<jupyter_code>import arangomlFeatureStore as p
print(p.__path__)
import sys
sys.path.append(p.__path__)
!chmod -R 777 /usr/local/lib/python3.7/dist-packages/arangomlFeatureStore
!chmod -R 777 /usr/local/lib/python3.7/dist-packages/arangomlFeatureStore
import sys
sys.path.insert(0, "/usr/local/lib/python3.7/dist-packages/arangomlFeatureStore")<jupyter_output><empty_output><jupyter_text>Interaction1.   Producer applications:Register/add entities with the feature storeCreate embeddings for themAssociate entities with feature values. The association is identified by a tag2. Consumer applications:  Can search for a set of features that match a tag property  Can lookup/search for an entity by propertyUsage scenario:Producer applications create embeddings and store them in the feature store. Consumer applications consume embeddings by specifying a featureset tag.  Connect to Oasis and get a Database<jupyter_code>from arangomlFeatureStore.feature_store_admin import FeatureStoreAdmin
from arango.database import StandardDatabase
fa = FeatureStoreAdmin()
fa = FeatureStoreAdmin()
db = fa.db
import uuid<jupyter_output><empty_output><jupyter_text>Add an Entity<jupyter_code>fs = fa.get_feature_store()
rk = str(uuid.uuid4())
test_entity = {'_key': 'test_entity' + rk , 'attribute': 'some value'}
entity_info = fs.add_entity(test_entity)
cfg = fa.cfg
ENTITY_COLL = cfg['arangodb']['entity_col']
assert entity_info['_id'] == ENTITY_COLL + '/' + ('test_entity' + rk)
assert entity_info['_key'] == ('test_entity' + rk)<jupyter_output><empty_output><jupyter_text>Add a Feature Value<jupyter_code>rk2 = str(uuid.uuid4())
test_value = {'_key': 'test_value' + rk2, 'attribute': [0.1234, 0.1234, 0.1234]}
value_info = fs.add_value(test_value)
cfg = fa.cfg
FEATURE_VAL_COLL = cfg['arangodb']['feature_value_col']
assert value_info['_id'] == FEATURE_VAL_COLL + '/' + ('test_value' + rk2)
assert value_info['_key'] == ('test_value' + rk2)<jupyter_output><empty_output><jupyter_text>Associate a Feature Value with an Entity**Note**: Note the tag attribute specified<jupyter_code>edoc = {'_from': entity_info['_key'],'_to': value_info['_key'], 'tag': 'model-xyz'}
edge_info = fs.link_entity_feature_value(edoc)
EDGE_COLL = cfg['arangodb']['edge_col']
# edge_id = EDGE_COLL + '/' + edge_info['_key'] + '-' + value_info['_key']
# assert edge_info['_id'] == edge_id<jupyter_output><empty_output><jupyter_text>Lookup/Search for an Entity by Tag<jupyter_code>fs.find_entity(attrib_name='_key', attrib_value= "test_entity" + rk)<jupyter_output><empty_output><jupyter_text>Add a Dataset with a Tag attribute to the Feature Store<jupyter_code>DATASET_SIZE = 10
EDGE_COLL = cfg['arangodb']['edge_col']
for i in range(DATASET_SIZE):
  rkd = str(uuid.uuid4())
  test_entity_ds = {'_key': 'test_entity' + rkd , 'attribute': 'some value'}
  entity_info_ds = fs.add_entity(test_entity_ds)
  rkd2 = str(uuid.uuid4())
  test_value_ds = {'_key': 'test_value' + rkd2, 'attribute': [0.1234, 0.1234, 0.1234]}
  value_info_ds = fs.add_value(test_value_ds)
  edoc_ds = {'_from': entity_info_ds['_key'],'_to': value_info_ds['_key'], 'tag': 'model-xyz'}
  edge_info_ds = fs.link_entity_feature_value(edoc_ds)
  print(f"Added doc # {(i+1)} to feature store with tag: model-xyz")<jupyter_output><empty_output><jupyter_text>Retrieve a FeatureSet with a specified Tag Property Value<jupyter_code>fs.get_featureset_with_tag('tag', 'model-xyz')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13201409596096503, 'fraction_numerical': 0.01626457034426674, 'mean_word_length': 7.405466970387244, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '164911', 'license': 'MIT', 'n_tokens_mistral': 1365, 'n_tokens_neox': 1311, 'n_words': 274, 'path': 'examples/arangomlFeatureStoreDemo.ipynb', 'repo_name': 'rajivsam/arangomlFeatureStore', 'size': '3689'}