# how to make new class from the test data in machine learning

I have a list of accounts as data set and I need to group the accounts that refer to the same user using many features.

I'm thinking to use machine learning( but I'm new in this domain), because I know the group of each account for the training data set.

example of training data:

account-id  Feature1    Feature2    class(Group)
1            T1          P4          Gr1
2            T2          P4          Gr1
3            T3          P2          Gr2


The problem is in the testing of data and when a new account arrive for a new group not learned before in the training set.

example of testing data:

account-id   Feature1   Feature2
4             T5         P5
5             T6         P5
6             T3         P2


The groups of the testing data should be as following:

account-id   Feature1   Feature2   class(Group)
4             T5         P5         Gr3
5             T6         P5         Gr3
6             T3         P2         Gr2


The accounts 4 and 5 are in a new group (Gr3) which is not learned before in the training data.

My question is how could I group the new data under a new class that is not defined before in the learning phase ? and which algorithm can I use to solve this issue ?

1. Train a one versus all classifier $\psi_k$ for each class $k$ in your training set. Predict the test set with each one of those. Test instances that get rejected by each classifier belong to an unseen class.
2. Train a typical multiclass classifier $\psi_1^\prime$ on your training set and a one-class classifier $\psi_2^\prime$ on all the training data. Test instances that get rejected by the one-class classifier $\psi_2^\prime$ belong to an unseen class, instances that get recognized by $\psi_2^\prime$ can be run through the multiclass classifier $\psi_1^\prime$.