data = Table[x -> Sin[x] + RandomVariate[NormalDistribution[0,.15]] , {x, 0,2π,.001}];

data2 = Table[x -> x Sin[x] +  Cos[x] + RandomVariate[NormalDistribution[0,.15]],
{x,0,8π, .001}];

Values[data2];
Max[Values[data2]]

ListPlot[List@@@data2, PlotStyle->Dashed]

ListPlot[List@@@data,PlotStyle->Dashed]

data = RandomSample[data];
trainData = Take[data,{1,Floor[0.6*Length[data]]}];
validationData = Take[data,{Floor[0.6*Length[data]]+1,Floor[0.8*Length[data]]}];
testData = Take[data,{Floor[0.8*Length[data]]+1,Length[data]}];
Total[Length /@ {trainData,validationData, testData}] - Length[data]
Length /@ {trainData,validationData,testData}

data2 = RandomSample[data2];
trainData2 = Take[data2,{1,Floor[0.6*Length[data2]]}];
validationData2 = Take[data2,{Floor[0.6*Length[data2]]+1,Floor[0.8*Length[data2]]}];
testData2 = Take[data2,{Floor[0.8*Length[data2]]+1,Length[data2]}];
Total[Length /@ {trainData2,validationData2, testData2}] - Length[data2]
Length /@ {trainData2,validationData2,testData2}

modelSinCos = NetChain[{
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[1]}]

fitSinCos2 = NetTrain[modelSinCos,trainData2,All,ValidationSet->validationData2,LossFunction->MeanSquaredLossLayer[],
MaxTrainingRounds->3000, BatchSize->64]

fitSinCos2["RoundMeasurements"]

trained = fitSinCos2["TrainedNet"];
testData2X = Keys[testData2];
testData2Y = Values[testData2];
predictedTestY = trained[testData2X ];
predictedTestData = MapThread[List,{testData2X, predictedTestY}];
ListPlot[{predictedTestData,List@@@ RandomSample[testData2,500]},PlotLegends -> {"predicted value", "actual"}]

RandomSample[testData2,10]

model1 = NetChain[{
LinearLayer[16],
Ramp,
LinearLayer[1]}]

RandomSample[trainData,10]

history1 = NetTrain[model1,trainData,All,ValidationSet->validationData,MaxTrainingRounds->1000, BatchSize->16]

trainedNet1 = history1["TrainedNet"]

testDataX = Keys[testData];
testDataY = Values[testData];

ListPlot[List@@@testData]

predictedTestY = trainedNet1[testDataX];

MapThread[List, {{a,b,c}, {e,f,g}}]

predictedTestData = MapThread[List,{testDataX, predictedTestY}];

ListPlot[{predictedTestData,List@@@ testData},PlotLegends -> {"predicted value", "actual"}]

model2 = NetChain[{
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[1]}]

history2 = NetTrain[model2,trainData,All,ValidationSet->validationData,MaxTrainingRounds->1000, BatchSize->16]

trainedNet2 = history2["TrainedNet"]

model2predictedTestY = trainedNet2[testDataX];

newpredictedTestData = MapThread[List,{testDataX, model2predictedTestY}];

ListPlot[{newpredictedTestData,List@@@ testData},PlotLegends -> {"predicted value", "actual"}]

model3 = NetChain[{
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[16],
Ramp,
LinearLayer[1]}]

history3= NetTrain[model3,trainData,All,ValidationSet->validationData,MaxTrainingRounds->1000, BatchSize->16]

trainedNet3 = history3["TrainedNet"]

model3predictedTestY = trainedNet3[testDataX];

newpredicted3TestData = MapThread[List,{testDataX, model3predictedTestY}];

ListPlot[{newpredicted3TestData,List@@@ testData},PlotLegends -> {"predicted value", "actual"}]