5
$\begingroup$

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?

$\endgroup$
11
  • $\begingroup$ Let's say you show us an example of what you have done so far, and some data to play with, and then we'll go from there. $\endgroup$
    – MarcoB
    Commented Mar 23, 2016 at 23:00
  • $\begingroup$ Yes, please provide a minimum working example and then maybe we can help. If the training set is small, I presume it would not be too hard to simply re-train on the larger (therefore more computationally expensive) set, yes? $\endgroup$ Commented Mar 24, 2016 at 1:12
  • 2
    $\begingroup$ Currently, no, there isn't a way to do that. $\endgroup$
    – rcollyer
    Commented Mar 24, 2016 at 3:44
  • 2
    $\begingroup$ What you are looking for is online learning. $\endgroup$
    – Silvia
    Commented Mar 24, 2016 at 4:14
  • $\begingroup$ @rcollyer is progressive and/or online learning still not available in mathematica? $\endgroup$
    – LLlAMnYP
    Commented Mar 21, 2018 at 11:21

1 Answer 1

2
$\begingroup$

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?

Yes, this possible using certain types of algorithms.

This MathematicaVsR at GitHub project

shows how this is done with Tries with Frequencies(TF). (TF can be seen as Naive Bayesian Classifiers.) This Markdown document from the linked project has detailed explanations.

Here is an example run:

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ This is... formidable, to say the least. It'll take some time to get my head around it. +1 $\endgroup$
    – LLlAMnYP
    Commented Apr 16, 2018 at 6:52
  • $\begingroup$ Thanks! I strongly consider giving a presentation on this subject at WTC-2018... $\endgroup$ Commented Apr 16, 2018 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.