Metrics and loss methods skeletonizedtags/v0.20
@@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "test\TensorFlow | |||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tensorflow.Keras", "src\TensorFlowNET.Keras\Tensorflow.Keras.csproj", "{6268B461-486A-460B-9B3C-86493CBBAAF7}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tensorflow.Keras", "src\TensorFlowNET.Keras\Tensorflow.Keras.csproj", "{6268B461-486A-460B-9B3C-86493CBBAAF7}" | ||||
EndProject | EndProject | ||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tensorflow.Keras.UnitTest", "test\Tensorflow.Keras.UnitTest\Tensorflow.Keras.UnitTest.csproj", "{EB92DD90-6346-41FB-B967-2B33A860AD98}" | |||||
EndProject | |||||
Global | Global | ||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
Debug|Any CPU = Debug|Any CPU | Debug|Any CPU = Debug|Any CPU | ||||
@@ -51,6 +53,14 @@ Global | |||||
{6268B461-486A-460B-9B3C-86493CBBAAF7}.Release|Any CPU.Build.0 = Release|Any CPU | {6268B461-486A-460B-9B3C-86493CBBAAF7}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
{6268B461-486A-460B-9B3C-86493CBBAAF7}.Release|x64.ActiveCfg = Release|Any CPU | {6268B461-486A-460B-9B3C-86493CBBAAF7}.Release|x64.ActiveCfg = Release|Any CPU | ||||
{6268B461-486A-460B-9B3C-86493CBBAAF7}.Release|x64.Build.0 = Release|Any CPU | {6268B461-486A-460B-9B3C-86493CBBAAF7}.Release|x64.Build.0 = Release|Any CPU | ||||
{EB92DD90-6346-41FB-B967-2B33A860AD98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{EB92DD90-6346-41FB-B967-2B33A860AD98}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{EB92DD90-6346-41FB-B967-2B33A860AD98}.Debug|x64.ActiveCfg = Debug|Any CPU | |||||
{EB92DD90-6346-41FB-B967-2B33A860AD98}.Debug|x64.Build.0 = Debug|Any CPU | |||||
{EB92DD90-6346-41FB-B967-2B33A860AD98}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{EB92DD90-6346-41FB-B967-2B33A860AD98}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
{EB92DD90-6346-41FB-B967-2B33A860AD98}.Release|x64.ActiveCfg = Release|Any CPU | |||||
{EB92DD90-6346-41FB-B967-2B33A860AD98}.Release|x64.Build.0 = Release|Any CPU | |||||
EndGlobalSection | EndGlobalSection | ||||
GlobalSection(SolutionProperties) = preSolution | GlobalSection(SolutionProperties) = preSolution | ||||
HideSolutionNode = FALSE | HideSolutionNode = FALSE | ||||
@@ -0,0 +1,29 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class Args | |||||
{ | |||||
private List<object> args = new List<object>(); | |||||
public object this[int index] | |||||
{ | |||||
get | |||||
{ | |||||
return args.Count < index ? args[index] : null; | |||||
} | |||||
} | |||||
public T Get<T>(int index) | |||||
{ | |||||
return args.Count < index ? (T)args[index] : default(T); | |||||
} | |||||
public void Add<T>(T arg) | |||||
{ | |||||
args.Add(arg); | |||||
} | |||||
} | |||||
} |
@@ -20,7 +20,7 @@ namespace Tensorflow.Keras.Engine | |||||
} | } | ||||
public void enter(Layer layer, Tensor[] inputs, Graph build_graph, bool training, Saving saving = null) => throw new NotImplementedException(); | |||||
public void enter(Layer layer, Tensor[] inputs, Graph build_graph, bool training) => throw new NotImplementedException(); | |||||
public bool training_arg_passed_to_call(string[] argspec, Dictionary<string, object> args, Dictionary<string, object> kwargs) => throw new NotImplementedException(); | public bool training_arg_passed_to_call(string[] argspec, Dictionary<string, object> args, Dictionary<string, object> kwargs) => throw new NotImplementedException(); | ||||
@@ -4,7 +4,7 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Engine | namespace Tensorflow.Keras.Engine | ||||
{ | { | ||||
class Node | |||||
public class Node | |||||
{ | { | ||||
} | } | ||||
} | } |
@@ -1,10 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras.Engine | |||||
{ | |||||
public class Saving | |||||
{ | |||||
} | |||||
} |
@@ -4,7 +4,8 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Engine | namespace Tensorflow.Keras.Engine | ||||
{ | { | ||||
class Sequential | |||||
public class Sequential | |||||
{ | { | ||||
} | } | ||||
} | } |
@@ -0,0 +1,43 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class KwArgs | |||||
{ | |||||
private Dictionary<string, object> args = new Dictionary<string, object>(); | |||||
public object this[string name] | |||||
{ | |||||
get | |||||
{ | |||||
return args.ContainsKey(name) ? args[name] : null; | |||||
} | |||||
set | |||||
{ | |||||
args[name] = value; | |||||
} | |||||
} | |||||
public T Get<T>(string name) | |||||
{ | |||||
if (!args.ContainsKey(name)) | |||||
return default(T); | |||||
return (T)args[name]; | |||||
} | |||||
public static explicit operator KwArgs(ValueTuple<string, object>[] p) | |||||
{ | |||||
KwArgs kwArgs = new KwArgs(); | |||||
kwArgs.args = new Dictionary<string, object>(); | |||||
foreach (var item in p) | |||||
{ | |||||
kwArgs.args[item.Item1] = item.Item2; | |||||
} | |||||
return kwArgs; | |||||
} | |||||
} | |||||
} |
@@ -6,5 +6,36 @@ namespace Tensorflow.Keras.Losses | |||||
{ | { | ||||
public abstract class Loss | public abstract class Loss | ||||
{ | { | ||||
public static Tensor mean_squared_error(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor mean_absolute_error(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor mean_absolute_percentage_error(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor mean_squared_logarithmic_error(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor _maybe_convert_labels(Tensor y_true) => throw new NotImplementedException(); | |||||
public static Tensor squared_hinge(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor hinge(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor categorical_hinge(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor huber_loss(Tensor y_true, Tensor y_pred, float delta = 1) => throw new NotImplementedException(); | |||||
public static Tensor logcosh(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor categorical_crossentropy(Tensor y_true, Tensor y_pred, bool from_logits = false, float label_smoothing = 0) => throw new NotImplementedException(); | |||||
public static Tensor sparse_categorical_crossentropy(Tensor y_true, Tensor y_pred, bool from_logits = false, float axis = -1) => throw new NotImplementedException(); | |||||
public static Tensor binary_crossentropy(Tensor y_true, Tensor y_pred, bool from_logits = false, float label_smoothing = 0) => throw new NotImplementedException(); | |||||
public static Tensor kullback_leibler_divergence(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor poisson(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor cosine_similarity(Tensor y_true, Tensor y_pred, int axis = -1) => throw new NotImplementedException(); | |||||
} | } | ||||
} | } |
@@ -1,10 +1,41 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class AUC | |||||
public class AUC : Metric | |||||
{ | { | ||||
public AUC(int num_thresholds= 200, string curve= "ROC", string summation_method= "interpolation", | |||||
string name= null, string dtype= null, float thresholds= 0.5f, | |||||
bool multi_label= false, Tensor label_weights= null) : base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
private void _build(TensorShape shape) => throw new NotImplementedException(); | |||||
public Tensor interpolate_pr_auc() => throw new NotImplementedException(); | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void reset_states() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class Accuracy | |||||
public class Accuracy : MeanMetricWrapper | |||||
{ | { | ||||
public Accuracy(string name = "accuracy", string dtype = null) | |||||
: base(Metric.accuracy, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,16 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class BinaryAccuracy | |||||
public class BinaryAccuracy : MeanMetricWrapper | |||||
{ | { | ||||
public BinaryAccuracy(string name = "binary_accuracy", string dtype = null, float threshold = 0.5f) | |||||
: base(Fn, name, dtype) | |||||
{ | |||||
} | |||||
internal static Tensor Fn(Tensor y_true, Tensor y_pred) | |||||
{ | |||||
return Metric.binary_accuracy(y_true, y_pred); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,16 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class BinaryCrossentropy | |||||
public class BinaryCrossentropy : MeanMetricWrapper | |||||
{ | { | ||||
public BinaryCrossentropy(string name = "binary_crossentropy", string dtype = null, bool from_logits = false, float label_smoothing = 0) | |||||
: base(Fn, name, dtype) | |||||
{ | |||||
} | |||||
internal static Tensor Fn(Tensor y_true, Tensor y_pred) | |||||
{ | |||||
return Losses.Loss.binary_crossentropy(y_true, y_pred); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class CategoricalAccuracy | |||||
public class CategoricalAccuracy : MeanMetricWrapper | |||||
{ | { | ||||
public CategoricalAccuracy(string name = "categorical_accuracy", string dtype = null) | |||||
: base(Metric.categorical_accuracy, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,16 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class CategoricalCrossentropy | |||||
public class CategoricalCrossentropy : MeanMetricWrapper | |||||
{ | { | ||||
public CategoricalCrossentropy(string name = "categorical_crossentropy", string dtype = null, bool from_logits = false, float label_smoothing = 0) | |||||
: base(Fn, name, dtype) | |||||
{ | |||||
} | |||||
internal static Tensor Fn(Tensor y_true, Tensor y_pred) | |||||
{ | |||||
return Losses.Loss.categorical_crossentropy(y_true, y_pred); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class CategoricalHinge | |||||
public class CategoricalHinge : MeanMetricWrapper | |||||
{ | { | ||||
public CategoricalHinge(string name = "categorical_hinge", string dtype = null) | |||||
: base(Losses.Loss.categorical_hinge, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,16 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class CosineSimilarity | |||||
public class CosineSimilarity : MeanMetricWrapper | |||||
{ | { | ||||
public CosineSimilarity(string name = "cosine_similarity", string dtype = null, int axis = -1) | |||||
: base(Fn, name, dtype) | |||||
{ | |||||
} | |||||
internal static Tensor Fn(Tensor y_true, Tensor y_pred) | |||||
{ | |||||
return Metric.cosine_proximity(y_true, y_pred); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class FalseNegatives | |||||
public class FalseNegatives : _ConfusionMatrixConditionCount | |||||
{ | { | ||||
public FalseNegatives(float thresholds = 0.5F, string name = null, string dtype = null) | |||||
: base(Utils.MetricsUtils.ConfusionMatrix.FALSE_NEGATIVES, thresholds, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class FalsePositives | |||||
public class FalsePositives : _ConfusionMatrixConditionCount | |||||
{ | { | ||||
public FalsePositives(float thresholds = 0.5F, string name = null, string dtype = null) | |||||
: base(Utils.MetricsUtils.ConfusionMatrix.FALSE_POSITIVES, thresholds, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class Hinge | |||||
public class Hinge : MeanMetricWrapper | |||||
{ | { | ||||
public Hinge(string name = "hinge", string dtype = null) | |||||
: base(Losses.Loss.hinge, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class KLDivergence | |||||
public class KLDivergence : MeanMetricWrapper | |||||
{ | { | ||||
public KLDivergence(string name = "kullback_leibler_divergence", string dtype = null) | |||||
: base(Losses.Loss.logcosh, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class LogCoshError | |||||
public class LogCoshError : MeanMetricWrapper | |||||
{ | { | ||||
public LogCoshError(string name = "logcosh", string dtype = null) | |||||
: base(Losses.Loss.logcosh, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,12 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class Mean | |||||
public class Mean : Reduce | |||||
{ | { | ||||
public Mean(string name, string dtype = null) | |||||
: base(Reduction.MEAN, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class MeanAbsoluteError | |||||
public class MeanAbsoluteError : MeanMetricWrapper | |||||
{ | { | ||||
public MeanAbsoluteError(string name = "mean_absolute_error", string dtype = null) | |||||
: base(Losses.Loss.mean_absolute_error, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class MeanAbsolutePercentageError | |||||
public class MeanAbsolutePercentageError : MeanMetricWrapper | |||||
{ | { | ||||
public MeanAbsolutePercentageError(string name = "mean_absolute_percentage_error", string dtype = null) | |||||
: base(Losses.Loss.mean_absolute_percentage_error, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,34 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class MeanIoU | |||||
public class MeanIoU : Metric | |||||
{ | { | ||||
public MeanIoU(int num_classes, string name, string dtype) : base(name, dtype) | |||||
{ | |||||
} | |||||
public override void reset_states() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,25 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class MeanMetricWrapper | |||||
public class MeanMetricWrapper : Mean | |||||
{ | { | ||||
public MeanMetricWrapper(Func<Tensor, Tensor, Tensor> fn, string name, string dtype = null) : base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,30 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class MeanRelativeError | |||||
public class MeanRelativeError : Metric | |||||
{ | { | ||||
public MeanRelativeError(Tensor normalizer, string name, string dtype) : base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class MeanSquaredError | |||||
public class MeanSquaredError : MeanMetricWrapper | |||||
{ | { | ||||
public MeanSquaredError(string name = "mean_squared_error", string dtype = null) | |||||
: base(Losses.Loss.mean_squared_error, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class MeanSquaredLogarithmicError | |||||
public class MeanSquaredLogarithmicError : MeanMetricWrapper | |||||
{ | { | ||||
public MeanSquaredLogarithmicError(string name = "mean_squared_logarithmic_error", string dtype = null) | |||||
: base(Losses.Loss.mean_squared_logarithmic_error, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,44 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class MeanTensor | |||||
public class MeanTensor : Metric | |||||
{ | { | ||||
public int total | |||||
{ | |||||
get | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
public int count | |||||
{ | |||||
get | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
public MeanTensor(int num_classes, string name = "mean_tensor", string dtype = null) : base(name, dtype) | |||||
{ | |||||
} | |||||
private void _build(TensorShape shape) => throw new NotImplementedException(); | |||||
public override void reset_states() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,63 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
public abstract class Metric | |||||
public abstract class Metric : Layers.Layer | |||||
{ | { | ||||
public string dtype | |||||
{ | |||||
get | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
public Metric(string name, string dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public void __new__ (Metric cls, Args args, KwArgs kwargs) => throw new NotImplementedException(); | |||||
public Tensor __call__(Metric cls, Args args, KwArgs kwargs) => throw new NotImplementedException(); | |||||
public virtual Hashtable get_config() => throw new NotImplementedException(); | |||||
public virtual void reset_states() => throw new NotImplementedException(); | |||||
public abstract void update_state(Args args, KwArgs kwargs); | |||||
public abstract Tensor result(); | |||||
public void add_weight(string name, TensorShape shape= null, VariableAggregation aggregation= VariableAggregation.Sum, | |||||
VariableSynchronization synchronization = VariableSynchronization.OnRead, Initializers.Initializer initializer= null, | |||||
string dtype= null) => throw new NotImplementedException(); | |||||
public static Tensor accuracy(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor binary_accuracy(Tensor y_true, Tensor y_pred, float threshold = 0.5f) => throw new NotImplementedException(); | |||||
public static Tensor categorical_accuracy(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor sparse_categorical_accuracy(Tensor y_true, Tensor y_pred) => throw new NotImplementedException(); | |||||
public static Tensor top_k_categorical_accuracy(Tensor y_true, Tensor y_pred, int k = 5) => throw new NotImplementedException(); | |||||
public static Tensor sparse_top_k_categorical_accuracy(Tensor y_true, Tensor y_pred, int k = 5) => throw new NotImplementedException(); | |||||
public static Tensor cosine_proximity(Tensor y_true, Tensor y_pred, int axis = -1) => throw new NotImplementedException(); | |||||
public static Metric clone_metric(Metric metric) => throw new NotImplementedException(); | |||||
public static Metric[] clone_metrics(Metric[] metric) => throw new NotImplementedException(); | |||||
public static string serialize(Metric metric) => throw new NotImplementedException(); | |||||
public static Metric deserialize(string config, object custom_objects = null) => throw new NotImplementedException(); | |||||
public static Metric get(object identifier) => throw new NotImplementedException(); | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class Poisson | |||||
public class Poisson : MeanMetricWrapper | |||||
{ | { | ||||
public Poisson(string name = "logcosh", string dtype = null) | |||||
: base(Losses.Loss.logcosh, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,41 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class Precision | |||||
public class Precision : Metric | |||||
{ | { | ||||
public Precision(float? thresholds = null, int? top_k = null, int? class_id = null, string name = null, string dtype = null) : base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public Precision(float[] thresholds = null, int? top_k = null, int? class_id = null, string name = null, string dtype = null) : base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void reset_states() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,25 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class PrecisionAtRecall | |||||
public class PrecisionAtRecall : SensitivitySpecificityBase | |||||
{ | { | ||||
public PrecisionAtRecall(float recall, int num_thresholds = 200, string name = null, string dtype = null) : base(recall, num_thresholds, name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,41 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class Recall | |||||
public class Recall : Metric | |||||
{ | { | ||||
public Recall(float? thresholds = null, int? top_k = null, int? class_id = null, string name = null, string dtype = null) : base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public Recall(float[] thresholds = null, int? top_k = null, int? class_id = null, string name = null, string dtype = null) : base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void reset_states() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,22 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class Reduce | |||||
public class Reduce : Metric | |||||
{ | { | ||||
public Reduce(string reduction, string name, string dtype= null) | |||||
: base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class RootMeanSquaredError | |||||
public class RootMeanSquaredError : Mean | |||||
{ | { | ||||
public RootMeanSquaredError(string name = "root_mean_squared_error", string dtype = null) | |||||
: base(name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,25 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class SensitivityAtSpecificity | |||||
public class SensitivityAtSpecificity : SensitivitySpecificityBase | |||||
{ | { | ||||
public SensitivityAtSpecificity(float specificity, int num_thresholds = 200, string name = null, string dtype = null) : base(specificity, num_thresholds, name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,26 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class SensitivitySpecificityBase | |||||
public class SensitivitySpecificityBase : Metric | |||||
{ | { | ||||
public SensitivitySpecificityBase(float value, int num_thresholds= 200, string name = null, string dtype = null) : base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void reset_states() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,12 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class SparseCategoricalAccuracy | |||||
public class SparseCategoricalAccuracy : MeanMetricWrapper | |||||
{ | { | ||||
public SparseCategoricalAccuracy(string name = "sparse_categorical_accuracy", string dtype = null) | |||||
: base(Metric.sparse_categorical_accuracy, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,16 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class SparseCategoricalCrossentropy | |||||
public class SparseCategoricalCrossentropy : MeanMetricWrapper | |||||
{ | { | ||||
public SparseCategoricalCrossentropy(string name = "sparse_categorical_crossentropy", string dtype = null, bool from_logits = false, int axis = -1) | |||||
: base(Fn, name, dtype) | |||||
{ | |||||
} | |||||
internal static Tensor Fn(Tensor y_true, Tensor y_pred) | |||||
{ | |||||
return Losses.Loss.sparse_categorical_crossentropy(y_true, y_pred); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,17 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class SparseTopKCategoricalAccuracy | |||||
public class SparseTopKCategoricalAccuracy : MeanMetricWrapper | |||||
{ | { | ||||
public SparseTopKCategoricalAccuracy(int k = 5, string name = "sparse_top_k_categorical_accuracy", string dtype = null) | |||||
: base(Fn, name, dtype) | |||||
{ | |||||
} | |||||
internal static Tensor Fn(Tensor y_true, Tensor y_pred) | |||||
{ | |||||
return Metric.sparse_top_k_categorical_accuracy(y_true, y_pred); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class SquaredHinge | |||||
public class SquaredHinge : MeanMetricWrapper | |||||
{ | { | ||||
public SquaredHinge(string name = "squared_hinge", string dtype = null) | |||||
: base(Losses.Loss.squared_hinge, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class Sum | |||||
public class Sum : Reduce | |||||
{ | { | ||||
public Sum(string name, string dtype = null) | |||||
: base(Reduction.SUM, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,10 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class SumOverBatchSize | |||||
public class SumOverBatchSize : Reduce | |||||
{ | { | ||||
public SumOverBatchSize(string name = "sum_over_batch_size", string dtype = null) : base(Reduction.SUM_OVER_BATCH_SIZE, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,25 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class SumOverBatchSizeMetricWrapper | |||||
public class SumOverBatchSizeMetricWrapper : SumOverBatchSize | |||||
{ | { | ||||
public SumOverBatchSizeMetricWrapper(Func<Tensor, Tensor, Tensor> fn, string name, string dtype = null) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,16 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class TopKCategoricalAccuracy | |||||
public class TopKCategoricalAccuracy : MeanMetricWrapper | |||||
{ | { | ||||
public TopKCategoricalAccuracy(int k = 5, string name = "top_k_categorical_accuracy", string dtype = null) | |||||
: base(Fn, name, dtype) | |||||
{ | |||||
} | |||||
internal static Tensor Fn(Tensor y_true, Tensor y_pred) | |||||
{ | |||||
return Metric.top_k_categorical_accuracy(y_true, y_pred); | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class TrueNegatives | |||||
public class TrueNegatives : _ConfusionMatrixConditionCount | |||||
{ | { | ||||
public TrueNegatives(float thresholds = 0.5F, string name = null, string dtype = null) | |||||
: base(Utils.MetricsUtils.ConfusionMatrix.TRUE_NEGATIVES, thresholds, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,7 +4,11 @@ using System.Text; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class TruePositives | |||||
public class TruePositives : _ConfusionMatrixConditionCount | |||||
{ | { | ||||
public TruePositives(float thresholds = 0.5F, string name = null, string dtype = null) | |||||
: base(Utils.MetricsUtils.ConfusionMatrix.TRUE_POSITIVES, thresholds, name, dtype) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,37 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
using static Tensorflow.Keras.Utils.MetricsUtils; | |||||
namespace Tensorflow.Keras.Metrics | namespace Tensorflow.Keras.Metrics | ||||
{ | { | ||||
class _ConfusionMatrixConditionCount | |||||
public class _ConfusionMatrixConditionCount : Metric | |||||
{ | { | ||||
public _ConfusionMatrixConditionCount(string confusion_matrix_cond, float thresholds= 0.5f, string name= null, string dtype= null) | |||||
: base(name, dtype) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor result() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void update_state(Args args, KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void reset_states() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,14 +1,42 @@ | |||||
using System; | |||||
using Keras.Layers; | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
using Tensorflow.Keras.Engine; | |||||
namespace Tensorflow.Keras | namespace Tensorflow.Keras | ||||
{ | { | ||||
class Models | class Models | ||||
{ | { | ||||
public class Model : Keras.Engine.Training.Model | |||||
{ | |||||
public class Model : Keras.Engine.Training.Model{} | |||||
} | |||||
public static Layer share_weights(Layer layer) => throw new NotImplementedException(); | |||||
private static Layer _clone_layer(Layer layer) => throw new NotImplementedException(); | |||||
private static Layer _insert_ancillary_layers(Model model, Layer ancillary_layers, string[] metrics_names, Node[] new_nodes) => throw new NotImplementedException(); | |||||
private static Node[] _make_new_nodes(Node[] nodes_by_depth, Func<Layer, Layer> layer_fn, Hashtable layer_map, Hashtable tensor_map) => throw new NotImplementedException(); | |||||
private static Model _clone_functional_model(Model model, Tensor[] input_tensors = null, Func<Layer, Layer> layer_fn = null) => throw new NotImplementedException(); | |||||
private static (Hashtable, Layer[]) _clone_layers_and_model_config(Model model, Layer[] input_layers, Func<Layer, Layer> layer_fn) => throw new NotImplementedException(); | |||||
private static (Layer[], Layer[]) _remove_ancillary_layers(Model model, Hashtable layer_map, Layer[] layers) => throw new NotImplementedException(); | |||||
private static Sequential _clone_sequential_model(Model model, Tensor[] input_tensors = null, Func<Layer, Layer> layer_fn = null) => throw new NotImplementedException(); | |||||
public static Model clone_model(Model model, Tensor[] input_tensors = null, Func<Layer, Layer> layer_fn = null) => throw new NotImplementedException(); | |||||
private static void _in_place_subclassed_model_reset(Model model) => throw new NotImplementedException(); | |||||
private static void _reset_build_compile_trackers(Model model) => throw new NotImplementedException(); | |||||
public static void in_place_subclassed_model_state_restoration(Model model) => throw new NotImplementedException(); | |||||
public static void clone_and_build_model(Model model, Tensor[] input_tensors= null, Tensor[] target_tensors= null, object custom_objects= null, | |||||
bool compile_clone= true, bool in_place_reset= false, VariableV1 optimizer_iterations= null, Hashtable optimizer_config= null) | |||||
=> throw new NotImplementedException(); | |||||
} | } | ||||
} | } |
@@ -1,10 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
class Ops | |||||
{ | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class Adadelta : Optimizer | |||||
{ | |||||
public Adadelta(float lr= 0.01f, float rho = 0.95f, float? epsilon = null, float decay = 0) : base(null) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor[] get_updates(Tensor loss, variables @params) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class Adagrad : Optimizer | |||||
{ | |||||
public Adagrad(float lr= 0.01f, float? epsilon = null, float decay = 0) : base(null) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor[] get_updates(Tensor loss, variables @params) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class Adam : Optimizer | |||||
{ | |||||
public Adam(float lr= 0.001f, float beta_1 = 0.9f, float beta_2 = 0.99f, float? epsilon = null, float decay = 0) : base(null) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor[] get_updates(Tensor loss, variables @params) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class Adamax : Optimizer | |||||
{ | |||||
public Adamax(float lr = 0.002f, float beta_1 = 0.9f, float beta_2 = 0.999f, float? epsilon = null, float decay = 0) : base(null) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor[] get_updates(Tensor loss, variables @params) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class Nadam : Optimizer | |||||
{ | |||||
public Nadam(float lr = 0.002f, float beta_1 = 0.9f, float beta_2 = 0.999f, float? epsilon = null, float schedule_decay = 0.004f) : base(null) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor[] get_updates(Tensor loss, variables @params) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,36 @@ | |||||
using NumSharp; | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class Optimizer | |||||
{ | |||||
public Optimizer(KwArgs kwargs) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public virtual Tensor[] get_updates(Tensor loss, variables @params) | |||||
{ | |||||
return null; | |||||
} | |||||
public virtual Tensor[] get_gradients(Tensor loss, variables @params) => throw new NotImplementedException(); | |||||
public virtual void set_weights(NDArray[] weights) => throw new NotImplementedException(); | |||||
public virtual NDArray[] get_weights() => throw new NotImplementedException(); | |||||
public virtual Hashtable get_config() => throw new NotImplementedException(); | |||||
public static string serialize(Optimizer optimizer) => throw new NotImplementedException(); | |||||
public static Optimizer deserialize(string config, object custom_objects = null) => throw new NotImplementedException(); | |||||
public static Optimizer get(object identifier) => throw new NotImplementedException(); | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class RMSprop : Optimizer | |||||
{ | |||||
public RMSprop(float lr= 0.01f, float rho = 0f, float? epsilon = null, float decay = 0) : base(null) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor[] get_updates(Tensor loss, variables @params) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow.Keras | |||||
{ | |||||
public class SGD : Optimizer | |||||
{ | |||||
public SGD(float lr= 0.01f, float momentum= 0, float decay= 0, bool nesterov= false) : base(null) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Tensor[] get_updates(Tensor loss, variables @params) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -4,7 +4,7 @@ using System.Text; | |||||
namespace Tensorflow.Keras.OptimizersV2 | namespace Tensorflow.Keras.OptimizersV2 | ||||
{ | { | ||||
class BaseOptimizerV2 | |||||
class OptimizerV2 | |||||
{ | { | ||||
} | } | ||||
} | } |
@@ -1,10 +1,25 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Regularizers | namespace Tensorflow.Keras.Regularizers | ||||
{ | { | ||||
class L1L2 | |||||
public class L1L2 : Regularizer | |||||
{ | { | ||||
public L1L2(float l1 = 0f, float l2 = 0f) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override float call(Tensor x) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override Hashtable get_config() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,10 +1,40 @@ | |||||
using System; | using System; | ||||
using System.Collections; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Regularizers | namespace Tensorflow.Keras.Regularizers | ||||
{ | { | ||||
public class Regularizer | |||||
public abstract class Regularizer | |||||
{ | { | ||||
public virtual float call(Tensor x) | |||||
{ | |||||
return 0f; | |||||
} | |||||
public static Regularizer from_config(Hashtable hashtable) => throw new NotImplementedException(); | |||||
public virtual Hashtable get_config() => throw new NotImplementedException(); | |||||
public static Regularizer l1(float l = 0.01f) | |||||
{ | |||||
return new L1L2(l1: l); | |||||
} | |||||
public static Regularizer l2(float l = 0.01f) | |||||
{ | |||||
return new L1L2(l2: l); | |||||
} | |||||
public static Regularizer l1_l2(float l1 = 0.01f, float l2 = 0.01f) | |||||
{ | |||||
return new L1L2(l1, l2); | |||||
} | |||||
public static string serialize(Regularizer regularizer) => throw new NotImplementedException(); | |||||
public static string deserialize(string config, dynamic custom_objects = null) => throw new NotImplementedException(); | |||||
public static Regularizer get(object identifier) => throw new NotImplementedException(); | |||||
} | } | ||||
} | } |
@@ -1,10 +1,60 @@ | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Reflection; | |||||
using System.Text; | using System.Text; | ||||
namespace Tensorflow.Keras.Utils | namespace Tensorflow.Keras.Utils | ||||
{ | { | ||||
class MetricsUtils | |||||
public class MetricsUtils | |||||
{ | { | ||||
public static class Reduction | |||||
{ | |||||
public const string SUM = "sum"; | |||||
public const string SUM_OVER_BATCH_SIZE = "sum_over_batch_size"; | |||||
public const string WEIGHTED_MEAN = "weighted_mean"; | |||||
} | |||||
public static class ConfusionMatrix | |||||
{ | |||||
public const string TRUE_POSITIVES = "tp"; | |||||
public const string FALSE_POSITIVES = "fp"; | |||||
public const string TRUE_NEGATIVES = "tn"; | |||||
public const string FALSE_NEGATIVES = "fn"; | |||||
} | |||||
public static class AUCCurve | |||||
{ | |||||
public const string ROC = "ROC"; | |||||
public const string PR = "PR"; | |||||
public static string from_str(string key) => throw new NotImplementedException(); | |||||
} | |||||
public static class AUCSummationMethod | |||||
{ | |||||
public const string INTERPOLATION = "interpolation"; | |||||
public const string MAJORING = "majoring"; | |||||
public const string MINORING = "minoring"; | |||||
public static string from_str(string key) => throw new NotImplementedException(); | |||||
} | |||||
public static dynamic update_state_wrapper(Func<Args, KwArgs, Func<bool>> update_state_fn) => throw new NotImplementedException(); | |||||
public static dynamic result_wrapper(Func<Args, Tensor> result_fn) => throw new NotImplementedException(); | |||||
public static WeakReference weakmethod(MethodInfo method) => throw new NotImplementedException(); | |||||
public static void assert_thresholds_range(float[] thresholds) => throw new NotImplementedException(); | |||||
public static void parse_init_thresholds(float[] thresholds, float default_threshold = 0.5f) => throw new NotImplementedException(); | |||||
public static Operation update_confusion_matrix_variables(variables variables_to_update, Tensor y_true, Tensor y_pred, float[] thresholds, | |||||
int? top_k= null,int? class_id= null, Tensor sample_weight= null, bool multi_label= false, | |||||
Tensor label_weights= null) => throw new NotImplementedException(); | |||||
private static Tensor _filter_top_k(Tensor x, int k) => throw new NotImplementedException(); | |||||
private static (Tensor[], Tensor) ragged_assert_compatible_and_get_flat_values(Tensor[] values, Tensor mask = null) => throw new NotImplementedException(); | |||||
} | } | ||||
} | } |
@@ -0,0 +1,14 @@ | |||||
using Microsoft.VisualStudio.TestTools.UnitTesting; | |||||
using System.Collections.Generic; | |||||
namespace Tensorflow.Keras.UnitTest | |||||
{ | |||||
[TestClass] | |||||
public class OptimizerTest | |||||
{ | |||||
[TestMethod] | |||||
public void BaseConstruct() | |||||
{ | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,20 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<PropertyGroup> | |||||
<TargetFramework>netcoreapp3.1</TargetFramework> | |||||
<IsPackable>false</IsPackable> | |||||
</PropertyGroup> | |||||
<ItemGroup> | |||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" /> | |||||
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" /> | |||||
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" /> | |||||
<PackageReference Include="coverlet.collector" Version="1.0.1" /> | |||||
</ItemGroup> | |||||
<ItemGroup> | |||||
<ProjectReference Include="..\..\src\TensorFlowNET.Keras\Tensorflow.Keras.csproj" /> | |||||
</ItemGroup> | |||||
</Project> |