Skip to main content
. Author manuscript; available in PMC: 2020 Mar 24.
Published in final edited form as: Proc Mach Learn Res. 2019 Aug;106:641–662.

Algorithm 1.

Generating Intakes

Input:
X = [x1, x2 . . ., xm], an array of vectors of features where xi = [f1, f2 . . ., famtFeat], a vector of features
F = [f1, f2 . . ., fm], an array of food categories associated with a corresponding instance of X
N, the minimum amount of intakes for each category
R, the number of iterations before regenerating a new Random Forest
Output:
Xnew: X concatenated with newly generated intake features
Fnew: F concatenated with newly generated intake categories
The length of each distinct type of Fnew is greater than or equal to N
1: count = 0
2: whilef(fF, ||f|| < N) do
3: dF < N
4: xd = xX | F = d
5: for i = 1 to amtFeat do
6:   Inewi=N(xdi¯,σ(xdi))
7: if count mod R = 0 then
8:   Ftrain = [f : fF, ||f|| < N]
9:   Xtrain = xX | FFtrain
10:   rf = Random Forest (Xtrain, Ftrain)
11: else
12:   Use previous rf
13: if rf.predict(Inew) = d then
14:   X.append(Inew)
15:   F.append(d)
16:   count+ = 1
17: return X,F