ai newsMo., 2. Nov.
EilmeldungMeituan's LongCat-2.5 Drops Into Claude Code at $0.30/$1.20. Its Setup Caps You at 200K

TensorFlow: Die Grundlagen der Machine Learning

Tensorflow ist eine Google-Bibliothek zur Implementierung von Machine-Learning-Algorithmen. Sie verarbeitet Daten als Tensor-Objekte.

dev.toSamstag 21:29 · 31.10.DE2 Min. Lesezeit
Bild: dev.to

Posted on Oct 31 • Originally published at practicaldevblog.blogspot.com

Machine learning sounds like magic until you see the machinery: numbers flow through operations, a model adjusts its parameters, and error goes down. TensorFlow, released by Google in 2015, is the library that packages that machinery: it represents data as tensors, multi-dimensional arrays, and gives you the tools to build, train, and ship models, from a laptop experiment to a phone app.

TensorFlow rests on a few distinctive ideas:

A tiny example shows the shape, a model that learns the line y = 2x + 1 from four examples:

import numpy as np import tensorflow as tf xs = np. array ([ 0.0, 1.0, 2.0, 3.0 ], dtype = np. float32 ) ys = np. array ([ 1.0, 3.0, 5.0, 7.0 ], dtype = np. float32 ) model = tf. keras. Sequential ([ tf. keras. layers. Input ( shape = ( 1,)), tf. keras. layers.

Dense ( units = 1 ) ]) model. compile ( optimizer = ' sgd ', loss = ' mean_squared_error ' ) model. fit ( xs, ys, epochs = 100, verbose = 0 ) print ( model. predict ( np. array ([ 4.0 ], dtype = np. float32 ))) Enter fullscreen mode Exit fullscreen mode Input(shape=(1,)) says each example is one number, Dense(units=1) adds a single output neuron, compile picks the optimiser and the loss, and fit trains for 100 passes over the data. Predicting for 4.0 gives a value near 9.0, not exactly, because training improves gradually rather than solving the equation outright.

TensorFlow trades simplicity for scale: it is a large library with a learning curve, small models are often easier in a smaller library like scikit-learn, and debugging a training run takes patience. When to reach for it: for neural networks, especially ones headed for production or mobile; a smaller library when the model is a simple regression or classifier.

TensorFlow is machine learning from tensors to training: data as arrays, models as stacked layers, and an ecosystem that carries a trained model onto phones, browsers, and servers. It trades a gentle learning curve for serious scale, and for neural networks that need to ship, that scale is the reason it endures.

Originaltitel: TensorFlow Explained: Machine Learning, From Tensors to TrainingQuelle: dev.to (dev.to). Original öffnen