Run TensorFlow Machine Learning Code In C# With Almost No Changes
Machine Learning is a super-exciting field with breakthroughs happening all the time. Researchers are constantly pushing computers to their limits, teaching them how to see, hear, read, write, and listen. Skills that used to be the exclusive domain of us humans.
The language of choice for machine learning is Python, and the most popular library is Google’s TensorFlow. Almost all code examples are written in Python and depend on TensorFlow and NumPy libraries.
This can be a problem for us C# and NET developers. We are confronted with a stark choice — either learn Python, or use NET machine learning libraries and painstakingly write our own C# code from scratch.
And in fact, this is the strategy I used in my Machine Learning Course. I studied lots of Python code that used Keras and TensorFlow, and then I meticulously wrote my own C# code from scratch that uses native CNTK and ML.NET libraries instead.
This approach works, but it has some disadvantages:
- My students are learning to write code in a very specific style that only applies to NET. These coding skills do not easily transfer to Python.
- CNTK and ML.NET don’t support certain TensorFlow features, so I have to use Python code to demonstrate them to C#…