Message Boards Message Boards

Control chernoff's faces package settings?

GROUPS:

First excuse my bad english. In this example, I can not control chernoff's face settings. For example, I want to match the following values Column 1 ==> Shape of the face. Column 2 ==> Color of the face. Column 3 ==> Eyebrows. Column 4 ==> Eyes. Column 5 ==> Smile.

(* here is the program: *)

Import["https://raw.githubusercontent.com/antononcube/\
MathematicaForPrediction/master/MathematicaForPredictionUtilities.m"]

Import["https://raw.githubusercontent.com/antononcube/\
MathematicaForPrediction/master/ChernoffFaces.m"]

data = {{7.5, 22, 10.5, 2.5, 1.5}, {5, 25, 10.5, 5, 4.5}, {5, 23, 10.5, 7.5, 
  0}, {7.5, 13, 0, 2.5, 3}, {5, 17, 7, 5, 0}, {5, 15.5, 10.5, 0, 
  0}, {5, 22, 10.5, 5, 1.5}, {5, 22.5, 10.5, 2.5, 4.5}, {2.5, 15.5, 
  10.5, 2.5, 0}, {2.5, 14.5, 10.5, 0, 1.5}, {7.5, 19, 3.5, 5, 
  3}, {7.5, 18, 0, 7.5, 3}, {5, 14, 0, 7.5, 1.5}, {5, 27.5, 10.5, 7.5,
   4.5}, {5, 13.5, 7, 0, 1.5}, {5, 25, 10.5, 5, 4.5}}

columnNames = {"Identificateur", "Hierarchie", "Deficience", 
   "Etat_struct", "Cote_globale"};

Manipulate[
 DynamicModule[{wsize = 800, hsize = 400, paneOpts},

  data = tableau;

  data = If[! MatrixQ[data], Transpose[{data}], data];

  numCols = Pick[Range[1, Dimensions[data][[2]]], 
    VectorQ[#, NumericQ] & /@ Transpose[data]];
  rdata = VariablesRescale[N@data[[All, numCols]]];

  paneOpts = {ImageSize -> {wsize, hsize}, Scrollbars -> True};

  TabView[{"Les Faces de Chernoff" -> 
     Pane[Multicolumn[
       MapIndexed[
        ChernoffFace[#1, PlotLabel -> #2[[1]], ImageSize -> 100] &, 
        rdata], 5, Appearance -> "Horizontal"], paneOpts], 
    "Résumé" -> 
     Pane[Grid[{{"Nom du Fichier", fichier <> ".csv"}, {"Dimensions", 
         Dimensions[data]}, {"Résumé", 
         Multicolumn[RecordsSummary[N@data, columnNames], 3, 
          Dividers -> All]}}, Alignment -> Left, Dividers -> All], 
      paneOpts], 
    "Data" -> 
     Pane[GridTableForm[tableau, TableHeadings -> columnNames], 
      paneOpts]}]]]
POSTED BY: Sheriff Sheriff
Answer
5 days ago

As explained in "Facing your data with Chernoff faces" you can/should use an Association giving values to the facial features of interest.

ChernoffFace["Properties"]

(* <|"FaceLength" -> 0.5, "ForeheadShape" -> 0.5, 
 "EyesVerticalPosition" -> 0.5, "EyeSize" -> 0.5, "EyeSlant" -> 0.5, 
 "LeftEyebrowSlant" -> 0.5, "LeftIris" -> 0.5, "NoseLength" -> 0.5, 
 "MouthSmile" -> 0.5, "LeftEyebrowTrim" -> 0.5, 
 "LeftEyebrowRaising" -> 0.5, "MouthTwist" -> 0.5, 
 "MouthWidth" -> 0.5, "RightEyebrowTrim" -> 0.5, 
 "RightEyebrowRaising" -> 0.5, "RightEyebrowSlant" -> 0.5, 
 "RightIris" -> 0.5, "FaceColor" -> GrayLevel[1], 
 "IrisColor" -> GrayLevel[0.85], "NoseColor" -> Automatic, 
 "MouthColor" -> GrayLevel[0], "EyeBallColor" -> GrayLevel[1], 
 "MakeSymmetric" -> True|> *)

faceFeatures = {"FaceLength", "FaceColor", "LeftEyebrowSlant", "EyeSize", "MouthSmile"};
faces = Map[
   ChernoffFace[
     AssociationThread[faceFeatures, MapAt[ColorData["TemperatureMap", "ColorFunction"], #, 2]]] &, 
   VariablesRescale[data]];

Row[{Grid[
   Partition[#, 4] &@Map[Append[#, ImageSize -> 100] &, faces]], 
  "   ", Magnify[#, 0.85] &@
   GridTableForm[List /@ faceFeatures, 
    TableHeadings -> {"Face part"}]}]

enter image description here

POSTED BY: Anton Antonov
Answer
5 days ago

thank you very much !

POSTED BY: Sheriff Sheriff
Answer
5 days ago

Group Abstract Group Abstract