Find out how Hershey leveraged the Internet of Things, cloud computing, machine learning, and big data to regulate production at its factories, without hiring a data scientist.

Video: Everything you need to know about the Internet of Things Watch Now

The Internet of Things (IoT) is good for business optimization, but could be bad for candy lovers. Twizzlers and eventually other Hershey's candies, such as Reese's Peanut Butter Cups, are going to get smaller now that Hershey is adding IoT sensors to its candy-making manufacturing facilities to make the process more efficient through machine learning.

The process to start using machine learning and predictive analytics at Hershey, which makes Twizzlers and 79 other brands of candy, began on a single Twizzlers factory line. Hershey used Microsoft Azure to utilize algorithms to improve the manufacturing process.

"We were able to utilize the precooked algorithms inside of Azure to wire up all of the machine learning. We literally were able to build this without a data scientist," said George Lenhart, senior manager, advanced productivity and collaboration, at Industry of Things World USA in San Diego, Calif.

And if you're wondering what Lenhart's favorite treat is, it's Twizzlers lemon-filled licorice twists, which he said are "like unicorns" in that they're so rare.

SEE: How to Implement AI and Machine Learning (ZDNet special feature)

The reason for the sizing change is because the addition of sensors to holding tanks with 14,000 pounds of Twizzlers allows for better regulation of temperature and other factors. So, Hershey can be more precise and no longer has to make its candies slightly bigger than the packaging professes in order to ensure they are within legal sizing guidelines.

"As we get better at this, you'll get less of Reese's Peanut Butter Cups. I have to give you 2 ounces. I can't give you 1.99 ounces, so I give you 2.19 ounces. We predict what the weight will be before we give you the candy," Lenhart said.

Twizzlers are poured in hot at the top of the vast holding tank, and the candy is extruded at the bottom of the tank. Through the addition of IoT sensors to monitor the temperature of the hot Twizzlers in each holding tank, the company learned some new things about its candy.

"We found out that it was a lot more than just a holding tank. Licorice goes in at one temperature, it ages a bit, not like wine, but it cools a bit. It becomes this living thing, the 14,000 pounds of licorice. When the new licorice went on top, it was so hot, the variability started," he said. And when the licorice is too hot, it thins, and the Twizzlers don't weigh as much as they should.

There are 22 sensors on a cooking vat, and they assess the temperature every second of every minute while the licorice is in the tank. "That's 60 million data points I used to train the machine based on this array to know which ones would fail," he said.

Every 1% adjustment downward in size to bring the Twizzlers closer to the precise weight, in a 14,000-gallon batch, results in $500,000 in savings, Lenhart said. "And that's in sugar and flour [for Twizzlers]. Imagine when we take that same philosophy and apply it to chocolate?" Since chocolate is more expensive than sugar and flour, the savings would be more substantial, he said.

Image: Teena Maddox/TechRepublic

Lenhart said the company can better predict the net weight of the end product with the sensors. And, as they get better at predicting the net weight through machine learning, Hershey will be able to better predict the size of its products and stay closer to the exact required weight for each product.

The sensors also showed how, when the amount of Twizzlers in the holding tank reached a certain point, there was more variability in the sizing. The fix was simple--the tank was reprogrammed to not allow the amount of Twizzlers to get to that problem level again. "But, we didn't know this until we looked at the sensors. We only figured it out because we had that level of visibility and I noticed how this correlates to that," he said.

Getting the IoT project underway was an accomplishment as well. Lenhart said he heard four "nos" from executives before he finally got a "yes."

"I had to get higher than someone whose cost center I was going to affect. The first yes was the CIO," he said, joking that he should have just started with the CIO. "You can't stop with the first 'no.'"

Lenhart said he's talked to 20 other companies about the digital transformation he did at Hershey, and the top question was always, "how do I use the data I have?"

He said that anyone who wants to get started with machine learning at their company should follow these eight steps to leverage data:

Identify sensors - find as many sensors as possible Extract data - pull data from repositories/historians Cleanse data - clean data for analysis Hunt for outliers - Use Box Plots to find outliers Correlate data - use tools like PowerBI to display which sensors have effect Time to train - start training your machine and run tests Build web services - needed for analyzing data in real time Close the loop - sending control data back to the plant via secure path

Three takeaways for TechRepublic readers:

Hershey used IoT sensors and Microsoft Azure algorithms for machine learning to improve production efficiencies on a Twizzler candy line. Each 1% change in sizing for Twizzlers in a 14,000-pound holding tank resulted in a savings of $500,000. There are 22 sensors on each Twizzler holding tank, with 60 million data points collected.

Innovation Newsletter Be in the know about smart cities, AI, Internet of Things, VR, AR, robotics, drones, autonomous driving, and more of the coolest tech innovations. Delivered Wednesdays and Fridays Sign up today

Also see: