Disclaimer: I have edited this question to provide my MWE, since it seems, I have a very similar question. -- LLlAMnYP 21.03.2018
Lets say I have a small set of training data and have calculated a Predictor function from this set.
Is it possible to continue the training with a larger data set?
Here is an MWE with Classify
, as opposed to Predictor-
.
trainingData = {};
classifier =.
classes = {"groceries", "gas", "vet"};
appendTrainingData[example_, class_] :=
(classes = Union[classes, {class}];
trainingData = Union[trainingData, {example -> class}];
If[Length@trainingData > 5, classifier = Classify[trainingData]];
)
classifyNext[example_] :=
DynamicModule[{class = classifier[example], newclass = ""},
DialogInput[Grid[{
example~Join~{SpanFromLeft},
{"existing classes", PopupMenu[Dynamic[class], classes],
Button["<-- Use this", appendTrainingData[example, class];
DialogReturn[]]},
{"new class", InputField[Dynamic[newclass], String],
Button["Make new class", appendTrainingData[example, newclass];
DialogReturn[]]}},
ItemSize -> {{13, 40, 13}}]]]
Here's a small sample of the dataset:
data = {{"Kartenzahlung Payment Reference/E2E-Ref. \
NETTOMARKEN-DISCOU//MOEGLINGEN/DE 17-05-2017T19:40:11 Folgenr.09 \
Verfalld.1218", -40.46}, {"Kartenzahlung Payment Reference/E2E-Ref. \
TIERARZTPRAXIS//ASPERG/DE17-05-2017T16:47:46 Folgenr.09 \
Verfalld.1218", -72.74}, {"Kartenzahlung Payment Reference/E2E-Ref. \
NETTOMARKEN-DISCOU//MOEGLINGEN/DE 20-05-2017T19:03:10 Folgenr.09 \
Verfalld.1218", -3.05}, {"Kartenzahlung Payment Reference/E2E-Ref. \
ALDIGMBH+CO.KG//MOEGLINGEN/DE 20-05-2017 T18:52:06 Folgenr.09 \
Verfalld.1218", -17.63}, {"Auszahlung Geldautomat Payment \
Reference/E2E-Ref. ASPERG-SA.//KREISSPARKASSELUDWIGSBURG/DE \
21-05-2017T15:16:18 Folgenr.09 Verfalld.1218 Fremdentgelt 4,90EUR", \
-104.9}, {"SEPA Überweisungan GWG - Hausverwaltung \
IBANDE17600104241399000100 BIC AARBDE5W600 Payment Reference/E2E-Ref. \
20170601 835.035.02 /", -172.}, {"Auszahlung Geldautomat Payment \
Reference/E2E-Ref. 06500900 / COMMERZBANK-AG/FELLB./FELLBACH/DE \
19-05-2017T18:07:33 Folgenr.009 Verfalld.1218", -400.}, {"SEPA \
Lastschrifteinzug von TELEFONICAGERMANYG Payment Reference/E2E-Ref. \
FONIC170521QIXRV017698149256 201705212001259266 \
Creditor-IDDE9700000000142462 Mand-IDT02100010000000038649094 ULTC \
BobSmith RCUR Wiederholungslastschrift", -16.95}, \
{"Kartenzahlung Payment Reference/E2E-Ref. \
DANKE,IHRLIDL//Moeglingen/DE26-05-2017T20:07:36 Folgenr.09 \
Verfalld.1218", -8.56}, {"SEPA Überweisungan SMITH,BOB \
IBANDE8620123456789693700 BIC COBADEHD055 Payment Reference/E2E-Ref. \
-", -420.}, {"Kartenzahlung Payment Reference/E2E-Ref. \
NETTOMARKEN-DISCOU//MOEGLINGEN/DE 29-05-2017T18:42:26 Folgenr.09 \
Verfalld.1218", -13.61}, {"SEPA Lastschrifteinzug von \
UNITYMEDIABWGMBH Payment Reference/E2E-Ref. \
UNITYMEDIABWGMBHKDNR.8171135011RGN 000425413351102MAI2017 \
400R286747115226 Creditor-IDDE44ZZZ00000186290 \
Mand-IDUMKBW00020007413229 ULTCTIMOFEILARKIN 20170601 / RCUR \
Wiederholungslastschrift", -31.7}, {"SEPA Überweisungan Doe, \
John IBANDE11212345611886600 BIC COBADEHD044 Payment \
Reference/E2E-Ref. -", -300.}}
(this is a banking statement from which my more personal records have been removed).
Running
Map[classifyNext, data]
will repeatedly bring up dialog boxes asking one to either classify the next entry with an existing class or to type in a new class. It will attempt to suggest a class using the classifier
as soon as it has enoug training data entries (Length > 5
). The only problem is that it updates the classifier by retraining it from scratch at every step and this takes longer and longer each time.
Can this bottleneck be overcome?