Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib-base/src/PredictorStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <Ios/IoManip.hpp>
#include <Math/GeneralMath.hpp>
#include <Util/CoutBuf.hpp>
#include <Util/ToolsMixed.hpp>
#include <Visual/AsciiMisc.hpp>
#include <Statistical/Statistical.hpp>

using namespace EnjoLib;
Expand All @@ -30,7 +30,7 @@ EnjoLib::Str PredictorStats::GenRepNext(const PredictorStatsRes & res) const
oss << "\nRMS Pred 2 True\t = " << res.rmsPred2Truth << " -> ";
oss << (res.rmsPred2Truth >= res.rmsBase2Truth ? ":( not better" : "^_^ Better!") << " than the baseline.";
//oss << "\nRMS Pred 2 Base\t = " << rmsPred2Base;
oss << "\nRatio Pred2Base\t = " << res.ratioPred2Base << " " << ToolsMixed().GenBars10(res.points) << Nl;
oss << "\nRatio Pred2Base\t = " << res.ratioPred2Base << " " << AsciiMisc().GenBars10(res.points) << Nl;
return oss.str();
}

Expand Down
18 changes: 11 additions & 7 deletions src/tsqsim-lib/src/SimulatorTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,21 +324,25 @@ void SimulatorTS::PrintExperimental() const
SimulatorTSReports().PrintReportSingleThreaded(m_per, m_cfgTS, m_dataMan.converted, descr, plots);
}
ELO

//LOG << ToolsMixed().GetPercentToAscii(m_predsPlot, 0, m_predsPlot.Max()) << Nl;

const PredictorStats statsPred;
const PredictorStatsRes & predPoints = statsPred.GenPoints(m_original, m_predsBaseline, m_preds);
LOG << statsPred.GenRepNext(predPoints) << Nl;

}

EnjoLib::VecD SimulatorTS::GetSeasonal(int period, int averages) const
{
Seasonal seasonal(m_per, averages);

const EnjoLib::VecD & ret = seasonal.Run(m_original);

const Str name = "seasonal";
LOGL << name << " = " << ret.Last() << Nl;
OutputVariable(ret, name);

return ret;
}

Expand All @@ -347,16 +351,16 @@ EnjoLib::VecD SimulatorTS::GetMA(int period) const
//EnjoLib::VecD ret;
const bool ema = false;
const DataOCHL & data = m_per.GetDataFull();

//EnjoLib::VecD ret = PredictorUtil().Regression(period, data.closes);
EnjoLib::VecD ret = PredictorUtil().SimpleMA(period, data.closes);
const EnjoLib::Statistical stat;
return stat.ReplaceLeadingZeroes(ret);

return ret;
}

EnjoLib::VecD SimulatorTS::GetMA2Diff(const EnjoLib::VecD & maa, int period) const
EnjoLib::VecD SimulatorTS::GetMA2Diff(const EnjoLib::VecD & maa, size_t period) const
{
EnjoLib::VecD ret;
GMat gmat;
Expand Down Expand Up @@ -426,7 +430,7 @@ const EnjoLib::VecD & SimulatorTS::GetOutputSeries(const PredictorOutputType & t
case PredictorOutputType::MA2DIFF:
return m_ma2Diff;
case PredictorOutputType::MA2DIFF_NO_SEASONAL:
return m_ma2DiffNoSeasonal;
return m_ma2DiffNoSeasonal;
case PredictorOutputType::RECONSTRUCTION:
return m_reconstr;
case PredictorOutputType::RECONSTRUCTION_PRED:
Expand Down
2 changes: 1 addition & 1 deletion src/tsqsim-lib/src/SimulatorTS.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class SimulatorTS : public ISimulatorTS
EnjoLib::VecD PredCommon(const IPredictor & predAlgo, const EnjoLib::VecD & data) const;
EnjoLib::VecD GetSeasonal(int period = 24, int averages = 26) const;
EnjoLib::VecD GetMA(int period = 100) const;
EnjoLib::VecD GetMA2Diff(const EnjoLib::VecD & maa, int period = 100) const;
EnjoLib::VecD GetMA2Diff(const EnjoLib::VecD & maa, size_t period = 100) const;
void OutputVariable(const EnjoLib::VecD & var, const EnjoLib::Str & name) const;
void OutputVariable(double var, const EnjoLib::Str & name) const;

Expand Down
1 change: 1 addition & 0 deletions src/tsqsim-lib/static/scripts/plot_acf_pacf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def plotSeasonalDecomposition(data, period, title, model='constant'):
#fig.show()
#plt.plot(result.seasonal)
#plt.plot(result.trend)
axs[0].set_title("Seasonal decompo. (" + str(period) + ") " + title)

plt.show()

Expand Down