Kryvich 165 Posted 5 hours ago (edited) If you have experience with CAI NEURAL API, you can help me. I need to create and train a neural network in Delphi like in TensorFlow, using the linear regression method:: import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense # Model Definition model = Sequential() model.add(Dense(64, input_dim=14, activation='relu')) # Input layer + first hidden layer model.add(Dense(128, activation='relu')) # Second hidden layer model.add(Dense(64, activation='relu')) # Third Hidden Layer model.add(Dense(46, activation='linear')) # Output layer # Compiling the model model.compile(optimizer='adam', loss='mean_squared_error') # Train the model ( X_train and y_train - training data) model.fit(X_train, y_train, epochs=50, batch_size=10, validation_split=0.2) # Prediction for a new order predicted_materials = model.predict(new_order) print(predicted_materials) I created a CAI NEURAL API model, prepared training data, and started training. NN := TNNet.Create(); NFit := TNeuralFit.Create(); CreateWorkMatPairLists(80{%}, 10{%}, 10{%}, TrainingPairs, ValidationPairs, TestPairs); NN.AddLayer([ TNNetInput.Create(WORKS_COUNT), TNNetFullConnectReLU.Create(64), TNNetFullConnectReLU.Create(128), TNNetFullConnectReLU.Create(64), TNNetFullConnectLinear.Create(MATERIALS_COUNT) ]); NFit.InitialLearningRate := 0.001; NFit.LearningRateDecay := 0.01; NFit.L2Decay := 0.00001; NFit.Fit(NN, TrainingPairs, ValidationPairs, TestPairs, {batchsize=}10, {epochs=}50); But I don't know how to set up the optimizer correctly (TensorFlow uses Adam). And how to set the loss function - mean squared error. Does the CAI NEURAL API have such functionality, or do I need to write it myself? Edited 5 hours ago by Kryvich Share this post Link to post