SmartEngine  1.6.0
Loss.h
1 // Copyright (C) Entropy Software LLC - All Rights Reserved
2 
3 #pragma once
4 
5 #include "GraphNode.h"
6 
7 namespace SmartEngine
8 {
9 
10 #pragma pack(push, 4)
11 struct LossCInfo : public GraphNodeCInfo
15 {
16  LossCInfo() { name = "Loss"; }
17 
23 
29 };
30 #pragma pack(pop)
31 
38 class SMARTENGINE_EXPORT ILoss : public IGraphNode
39 {
40 public:
41  SMARTENGINE_DECLARE_CLASS(ILoss)
42 
43 
44  virtual float GetLoss() = 0;
48 };
49 
53 SMARTENGINE_EXPORT ObjectPtr<ILoss> CreateLoss(const LossCInfo& cinfo);
54 
56 extern "C"
57 {
58  SMARTENGINE_EXPORT ObjPtr Loss_CreateInstance(const LossCInfo& cinfo);
59  SMARTENGINE_EXPORT float Loss_GetLoss(ObjPtr object);
60 }
62 
63 } // namespace SmartEngine
SmartEngine::CreateLoss
SMARTENGINE_EXPORT ObjectPtr< ILoss > CreateLoss(const LossCInfo &cinfo)
Creates an instance of ILoss.
SmartEngine::IGraphNode
A logical node in the AI graph. Some nodes, like NeuralNetwork, are composed of other nodes (neuron l...
Definition: GraphNode.h:34
SmartEngine::GraphNodeCInfo::name
const char * name
The name of this node.
Definition: GraphNode.h:21
SmartEngine::LossCInfo::networkOutput
IGraphNode * networkOutput
The output of the network. This is the actual value in the loss calculation. Usually a NeuralNetwork ...
Definition: Loss.h:22
SmartEngine::LossCInfo::LossCInfo
LossCInfo()
Definition: Loss.h:16
SmartEngine::ObjectPtr
Smart pointer to an IObject. Automatic ref counting.
Definition: ObjectPtr.h:16
SmartEngine
Definition: A2CTrainer.h:10
SmartEngine::LossCInfo
Data used to construct an ILoss instance
Definition: Loss.h:15
SmartEngine::ILoss
The loss of a NeuralNetwork is computed using the formula (Expected Ouput - Actual Output)^2 The mean...
Definition: Loss.h:39
SmartEngine::LossCInfo::targetValues
IGraphNode * targetValues
The output to compare against. This is the expected value in the loss calculation....
Definition: Loss.h:28