Like how we import oraclize in Solidity (as follows), is there some way to import tensorflow libraries for machine learning purpose?

import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";


You are thinking incorrectly about what you should be doing in Solidity (that is, on the Ethereum VM.) Solidity is not a general-purpose application development language, and Dapps reference the Ethereum blockchain as a state store with minimal computation - Solidity is a language for smart contracts. To get a sense of what you can/should do on-chain, play with Crypto Zombies.

While you can use the EVM for basic computation, it is exceptionally impractical, extremely expensive, and otherwise unnecessary for things like machine learning. As DenisM states, you can run TF off-chain and reference its results with Oraclize, but you will not be able to run long-running or computationally intensive TF tasks using the micro instance.

| improve this answer | |
  • As a quick addendum to this, Oraclize plans to introduce long-running instances. Some other alternatives also may include projects such as Golem/TrueBit. – DenisM May 30 '18 at 18:02

You can use Oraclize's computation datasource to do something with TF libraries, from within a docker container, running on an AWS micro instance. The instance can only run up to a max of ~10 minutes (assume 7 or 8 as spin-up is a part of this timer), so account for that if you decide to use it, you can read more on it at the official Oraclize documentation: https://docs.oraclize.it/#data-sources-computation

Any sort of machine-learning computations etc... are highly unlikely to take part on the EVM, as per Vitalik's own words, it's 1 million times more expensive than current mainstream computing, so makes very little sense in machine learning sense, except maybe to share/distribute models, or crowdsource training in some form and making the trained model available on-chain. The computation DS could be used for such an AI crowdsourced training initiative.

| improve this answer | |
  • Thanks! Certainly agree that it is not viable to use EVM to perform ML tasks. The original idea I had in mind was to initially to making smart contracts smarter through the use of ML without updating the EVM state machine. i.e., kind of of a getter method. – Nathan Aw Jun 5 '18 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.