Package: oceanai-py
Oceanai-pyWrapper library that allows a direct integration between the Ocean marketplace and artificial intelligence tools like tensorflowWith Oceanai-py, you can:Createartificial intelligence models: the current state of the library usesTensorflowfor the implementation of the AI models, anything that you can do withTensorflowyou can also do it withOceanai-pyBuyOCEAN marketplace datasets to use them on your modelsConsumeOCEAN datatokens, to access the services of the Ocean environment.Every function related to the OCEAN environment is fullfiled usingOcean.py.
Ocean.py is part of theOcean Protocoltoolset.This library is still in alpha state and you can expect running into problems.📚 Prerequisites🏗 Installation🏄 QuickstartObtaining Ocean datasets📖 Learn More⬆️ Releases🏛 License📚 PrerequisitesPython (recomended version 3.9) (Install from here)🏗 Installation#Is necesary to install tensorflow  and ocean-lib separately for aboiding download errors.pipinstalloceanai-py
pipinstalltensorflow
pipinstall--preocean-lib🏄 QuickstartThe source code of this example is also included on the folder samples of the libraryindex.pyThis file explains how to implement several types of AI models for the selected Ocean datasetimporttensorflowastffrommodel_goalimportModelGoalfromsrc.ia.tensorflow_s.sequential_spaceimportSequentialSpacefromsrc.ia.tensorflow_s.models.multilayer.multilayer_dataset_parserimportMultilayerDataParserfromsrc.ia.tensorflow_s.multilevel.multilevel_sequential_trainingimportMultilevelSequentialTraininginputs=[[0.1,0.3,0.4,0.4],[0.8,0.2,0.2,0.6],[0.2,0.6,0.4,0.3],[0.3,0.8,0.7,0.9],[0.1,0.2,0.3,0.2],[0.4,0.4,0.9,0.1],[0.1,0.3,0.2,0.5],[0.5,0.5,0.3,0.3],[0.7,0.6,0.2,0.5],]outputs=[[0.25,0.4],[0.5,0.4],[0.5,0.35],[0.55,0.8],[0.15,0.25],[0.4,0.5],[0.4,0.35],[0.5,0.3],[0.65,0.35],]args={"inputs":4,"outputs":2,"hidden":[20,20]}compileArgs={'optimizer':tf.keras.optimizers.Adamax(learning_rate=1e-3),'loss':tf.keras.losses.MeanSquaredError(),'metrics':[tf.keras.metrics.MeanSquaredError()]}fitArgs={'epochs':100,'batchSize':32}iters=10goal=ModelGoal(inputs,outputs)defsample():layers=[tf.keras.layers.Dense(units=args['inputs'],input_shape=(args['inputs'],)),# input layertf.keras.layers.Dense(units=20),# hidden layer 1tf.keras.layers.Dense(units=20),# hidden layer 2tf.keras.layers.Dense(units=args["outputs"])# output layer]space=SequentialSpace(layers)parser=MultilayerDataParser(2)training=MultilevelSequentialTraining(goal,parser,compileArgs,fitArgs,iters)model=training.apply(space)print('> outputs: '+str(outputs))print("> predictions: "+str(model.apply(inputs)))sample()Obtaining Ocean datasetsIn here we will explain how to obtain OCEAN datasets using oceanai-lib.fromsrc.ocean.occeanimportOcceand={'network':'https://rinkeby.infura.io/v3/proyectid','metadataCacheUri':'https://v4.aquarius.oceanprotocol.com','providerUri':'https://v4.provider.rinkeby.oceanprotocol.com',}occean=Occean(d,"private key my account","private key accout buying from")# create NFT token in the accoutn buying fromdata_nft=occean.publishNFTToken('NFTToken1','NFT1')##occean.createDatasetExmple()# the account we are buying from create the datatokendatatoken=occean.createDataToken(data_nft,2)#datatoken = occean.getDatatoken('token address') we can allso get the datatoken#creat exage id an the buyexange_id=occean.getExchangeId(datatoken,1,3)tx_result=occean.buy(datatoken,exange_id,1,2)📖 Learn moreOcean.py- Library for accessing to the OCEAN servicesTensorflow.js- Tensorflow AI library.⬆️ ReleasesComing soon.🏛 LicenseCopyright ((C)) 2021 Intelligent Trading Machines

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.