Q&A

Create a Working Neural Network Prediction System with C#

Many "AI experts" have sprung up in the machine learning space since the advent of ChatGPT and other advanced generative AI constructs late last year, but Dr. James McCaffrey of Microsoft Research is the real thing.

Having authored "The Data Science Lab" column for Visual Studio Magazine for more than a decade now, it's no surprise the pre-eminent data scientist was tapped to share his cutting-edge AI knowledge in a subject dear to his heart -- neural networking systems -- at an upcoming Visual Studio Live! developer conference in Las Vegas.

This topic is key in today's .NET-centric development ecosystem, as neural networks power the "deep learning" space of today's AI world, being a subset of machine learning, which is itself a subset of general AI.

Neural Networks Power Deep Learning
[Click on image for larger view.] Neural Networks Power Deep Learning (source: Microsoft).

Microsoft says: "Deep learning matters because as data volumes increase and computing capacity becomes more powerful and affordable, companies across retail, healthcare, transportation, manufacturing, technology, and other sectors are investing in deep learning to drive innovation, unlock opportunities, and stay relevant."

One of the exciting aspects of neural networks in ML is that they're loosely based on biological neural networks such as those found in the human brain. That, of course, brings up visions of someday attaining the Holy Grail of AI: artificial general intelligence.

The Human Brain and the Neural Network
[Click on image for larger view.] The Human Brain and the Neural Network (source: Microsoft).

While McCaffrey won't be delving into AGI (yet) in his March 4 session titled, "Introduction to Neural Networks Using C#," he will explain exactly what neural networks are and how they work in ML. He says attendees will leave the presentation with all the information they need to create a working neural network prediction system. Topics covered include: neural network architecture, data normalization, activation functions, loss functions, gradient descent training and model overfitting.

Specific questions that will be answered include:

  • What types of problems neural networks can solve
  • How neural networks work
  • How to implement a neural network using raw C#

We recently caught up with McCaffrey to learn more about his session in a short Q&A.

VisualStudioMagazine: What inspired you do present a session on introducing neural networks using C#?
McCaffrey: In addition to being practical and powerful prediction techniques, neural networks form the core of the large language model (GPT-4, LLaMA-2 and so on) software systems that are revolutionizing AI. Developers who understand neural network will have a better grasp of these large language models.

For those new to the concept, could you briefly explain what neural networks are and how they differ from other types of machine learning algorithms?
Neural networks are essentially large complex math functions that can predict a single numeric value (regression, for example an employee's income) or categorical values (classification, for example the political leaning of an employee).

"Unlike most classical machine learning techniques, neural networks can handle any kind of predictor data -- integer (employee age), floating point (employee salary), Boolean (employee sex), and categorical (employee State of residence)."

James McCaffrey, Research Software Engineer, Microsoft Research

Unlike most classical machine learning techniques, neural networks can handle any kind of predictor data -- integer (employee age), floating point (employee salary), Boolean (employee sex), and categorical (employee State of residence).

In addition to your day job at Microsoft Research, you write twice-monthly tutorials for "The Data Science Lab" column on the Visual Studio Magazine web site, where you routinely tutor similar techniques with both Python and C#. What are a few pros/cons of each language for data science projects?
Python has the advantage of being more popular than C# for developing machine learning and AI systems and so Python has a large body of existing code examples. But C# has the advantage of being much easier to integrate into application systems.

Inside the Session

What: Introduction to Neural Networks Using C#

When: March 5, 2024, 1:30 p.m. - 2:45 p.m.

Who: James McCaffrey, Research Software Engineer, Microsoft Research

Why: Developers who understand neural network will have a better grasp of large language models such as GPT-4, LLaMA-2, Gemini and more.

Find out more about Visual Studio Live!, taking place March 3-8, 2024, in Las Vegas

Which of the two languages do you personally prefer working with (no "it depends" answers allowed)?
For most of the small and medium-size systems I develop or collaborate on, I prefer using C#. It's a beautiful language! For very large, complex AI systems, I prefer using Python because Python has a larger library ecosystem.

In your presentation, you will discuss the types of problems that neural networks can and cannot solve. Could you give us an example of a problem well-suited for neural networks and one that is not?
Neural networks are well-suited for making predictions when the source data is tabular (such as column-based text files, Excel data, SQL data). The biggest weakness of neural networks is that they typically require at least 200 training data items (data with known, correct target values). For small datasets, neural networks typically don't work as well as classical machine learning techniques.

Model overfitting and effective training are significant challenges in neural network development. What strategies or best practices will you be sharing to help tackle these issues?
Model overfitting, where a trained model predicts well on training data but poorly on previously unseen data, is the biggest practical issue to deal with when using neural networks. I will demonstrate the simplest technique that works best in most scenarios -- the train-test grid-search technique. I will also explain the pros and cons of using dropout, train-validate-test, batch normalization, k-fold cross validation, regularization and jittering.

Can attendees expect to learn practical skills for developing their own neural network prediction systems? How will this session help bridge the gap between theoretical knowledge and practical implementation?
The goal of this presentation is for attendees to leave knowing how to implement a practical system, with just enough background theory needed to modify the presentation demo code to meet their own needs.

Note: Those wishing to attend the conference can save hundreds of dollars by registering early, according to the event's pricing page. "Register for VSLive! Las Vegas by the Year End Savings Deadline (Dec. 15) to save up to $500 and secure your seat for intensive developer training in exciting Las Vegas!" said the organizer of the developer conference, which is presented by the parent company of Visual Studio Magazine.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Build Your First AI Applications with Local AI

    "AI right now feels like a vast space which can be hard to jump into," says Craig Loewen, a senior product manager at Microsoft who is helping devs unsure about making that first daunting leap.

  • On Blazor Component Reusability - From Day 0

    "We want to try to design from Day One, even Day Zero, with reusability in mind," says Blazor expert Allen Conway in imparting his expertise to an audience of hundreds in an online tech event on Tuesday.

  • Decision Tree Regression from Scratch Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of decision tree regression using the C# language. Unlike most implementations, this one does not use recursion or pointers, which makes the code easy to understand and modify.

  • Visual Studio's AI Future: Copilot .NET Upgrades and More

    At this week's Microsoft Ignite conference, the Visual Studio team showed off a future AI-powered IDE that will leverage GitHub Copilot for legacy app .NET upgrades, along with several more cutting-edge features.

  • PowerShell Gets AI-ified in 'AI Shell' Preview

    Eschewing the term "Copilot," Microsoft introduced a new AI-powered tool for PowerShell called "AI Shell," available in preview.

Subscribe on YouTube