# Classifying numeric vector data [closed]

Neural Networks seem so complex these days. Can anyone please suggest a simple structure (i.e. code) for training numeric vector data: examples of 24 numeric inputs to produce 1 (integer) numeric output. Any help would be much appreciated, thanks!

• P.S. I've been trying to use NetChain[] but unclear to me – Putnik11 Oct 17 '19 at 7:29
• Welcome to Mathematica SE. Can you provide some code that you tried, so that specific hints can be given. The problem is not totally clear to me. – mgamer Oct 17 '19 at 7:57
• Have a read of this documentation: reference.wolfram.com/language/tutorial/… particularly this part: reference.wolfram.com/language/tutorial/… – Carl Lange Oct 17 '19 at 9:22
• Use Decision Trees or Naive Bayesian Classifiers. E.g. Classify[___,Method->"NaiveBayes"]. – Anton Antonov Oct 17 '19 at 10:53
• This question as written is too vague. It requires some indication of "typical" input and expected output. Along a minimal concrete example. – Daniel Lichtblau Oct 17 '19 at 22:43

The following code (1) takes example data -- a numerical matrix, (2) categorizes the last column, (3) picks 24 rows/vectors, (4) builds a classifier, and (5) tests the classifier over the rest of data's rows/vectors.

SeedRandom[323]

(* Get example data. *)
data = RandomSample[ExampleData[{"Statistics", "BostonHomes"}]];

Dimensions[data]

(* {506, 14} *)

(* Data summary. *)
ResourceFunction["RecordsSummary"][data]

(* Pick 24 vectors. *)
tind = 24;

(* Categorize the last column in order to make integer labels. *)
data[[All, -1]] =
Map[Piecewise[{{1, # < 17}, {2, 17 <= # < 22}, {3,
22 <= # < 25}, {4, # >= 50}}] &, data[[All, -1]]];

(* Train a Naive Bayesian Classifier. *)
cf =
Classify[data[[1 ;; tind, 1 ;; -2]] -> data[[1 ;; tind, -1]],
Method -> "NaiveBayes"]

(* Evaluate classification results. *)
Tally[