2
$\begingroup$

I have 9 attributes: x1,x2,x3,x4,...,x9 and I know that the attributes x9 must have the same value in a cluster and the attribute X1 have more importance than others (x2,...,x8)

I'm using Euclidean distance and I normalized the data in order to have values between 0 and 1. I'm also using "One-Hot Encode Data" method in attributes x3,x4,x5,x6,x7,x8,x9.

I'm correlating within columns.

What do you recommend to scale my dataset properly?


For clarity here's what some of the input data looks like

Raw Input - Example 0.0.1

          x1,   x2, x3_1, x3_2, x3_3, x3_4, x3_5, x3_6, x3_7, x3_8, x3_9, x3_10, x3_11, x3_12, x3_13, x3_14, x3_15, x4_1, x4_2, x4_3, x4_4, x4_5, x4_6, x4_7, x4_8, x4_9, x5_1, x6_1, x7_1, x7_2, x7_3, x8_1, x8_2, x8_3, x9_1, x9_2, x9_3, x9_4

1553803283.0,  8.0,  1.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,   0.0,   0.0,   0.0,   0.0,  1.0,  0.0,  0.0,  1.0,  1.0,  1.0,  0.0,  0.0,  0.0,  0.0,  1.0,  0.0,  0.0,  0.0,  1.0
1553803286.0,  8.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  1.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,   0.0,   0.0,   0.0,   0.0,  1.0,  0.0,  0.0,  1.0,  1.0,  1.0,  0.0,  0.0,  0.0,  0.0,  1.0,  0.0,  0.0,  0.0,  1.0
1553803287.0,  8.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  1.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,   0.0,   0.0,   0.0,   0.0,  1.0,  0.0,  0.0,  1.0,  1.0,  1.0,  0.0,  0.0,  0.0,  0.0,  1.0,  0.0,  0.0,  0.0,  1.0
1553803343.0, 24.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  1.0,  0.0,  0.0,  0.0,  0.0,  0.0,   0.0,   0.0,   0.0,   0.0,  0.0,  1.0,  0.0,  1.0,  1.0,  0.0,  1.0,  0.0,  0.0,  1.0,  0.0,  0.0,  1.0,  0.0,  0.0
1553803349.0, 24.0,  0.0,  0.0,  0.0,  0.0,  0.0,  1.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,   0.0,   0.0,   0.0,   0.0,  0.0,  1.0,  0.0,  1.0,  1.0,  0.0,  1.0,  0.0,  0.0,  1.0,  0.0,  0.0,  1.0,  0.0,  0.0

Abridged Input - Example 0.0.2

          x1,  x2,                 x3,                  x4,                 x5,                 x6,                 x7,                 x8,                 x9

1553803283.0, 8.0, <one-hot-length-15>, <one-hot-length-9>, <one-hot-length-1>, <one-hot-length-1>, <one-hot-length-3>, <one-hot-length-3>, <one-hot-length-4>
1553803286.0, 8.0, <one-hot-length-15>, <one-hot-length-9>, <one-hot-length-1>, <one-hot-length-1>, <one-hot-length-3>, <one-hot-length-3>, <one-hot-length-4>
1553803287.0, 8.0, <one-hot-length-15>, <one-hot-length-9>, <one-hot-length-1>, <one-hot-length-1>, <one-hot-length-3>, <one-hot-length-3>, <one-hot-length-4>

$\endgroup$
  • $\begingroup$ This is nearly identical to a question I ran across less than 24 hours ago... yeah the questions be different, but the set-up's the same... it would probably help answerers if either of ya provided more information, eg. what's the raw input look like? Doesn't have to be copied, just give people a better idea of your problem space with something similar. Specifically for scaling heard rumors in other questions that this may not necessarily be required... but that might be hear-say. $\endgroup$ – S0AndS0 Apr 18 at 17:11
  • 1
    $\begingroup$ Thank you for your help. The help of all of you is always very appreciated. The question you mentioned is from my brother, I created another question because they are different questions. My "raw data" (after using one hot encoding): pastebin.com/fRv4U9BU $\endgroup$ – Mario Apr 18 at 17:44
  • $\begingroup$ I already know that I can use different scales to give more importance to some attributes. However I am afraid to use scales that make no sense. How can I give more importance to a numeric and nominal (category) variables? In my dataset I have 2 numeric attributes and the others are nominal. I can give you more information if necessary @S0AndS0 $\endgroup$ – Mario Apr 18 at 17:52
  • $\begingroup$ Most welcome @Mario! Please edit the edits I've made, specifically the second formatted block, I think it'll help with getting readers up-to-speed with the things your asking. Also are you training for correlation within columns, between, columns, across all columns, etc...? In other words, having a sample of what is being fed to your NN is great, knowing how it feeds too will likely be even better for getting solid suggestions. And side note, I recognized that there where different questions, it was more to validate that feeling of déjà vu that other readers may have had. $\endgroup$ – S0AndS0 Apr 18 at 18:34
  • $\begingroup$ Thanks @S0AndS0 . I have just edited my post. I'm correlating within columns. $\endgroup$ – Mario Apr 18 at 19:35
0
$\begingroup$

Side note; looks like you've got three extra columns of data... somewhere... oh ya may have got that on the last edit, aside from the slightly wonky spacing it's far more comprehensible.


Recommendations based off information so far provided;

  • consider leveraging Word-2-Vec for some of the encoding, eg. x3 through x9, as it's a simple way of dealing with novel inputs; there'd still be the same number of columns, but the benefits may outweigh the costs of restructuring the network some.

  • in regards to columns x1 and x2, maybe take another glance at the paper linked to the other question I commented about. If I read it correctly they had some special sauce for feeding raw inputs into their network that maybe inspirational.


Information that will likely help with better answers or updates to this one would be;

  • what are you trying to model, eg. are you trying to predict, recognize/categorize, etc.?

  • what's the behavior of the network currently and what are you looking to improve?

  • what libraries, if any, are you using?


Simply put, I've found no fool proof, "proper" or the way for massaging inputs, however, depending upon how you frame what you want modeled there maybe options that are an easy fit.

Furthermore it may help in being flexible in what it is that you want modeled, try to frame things from a few different angles so to speak. Or for a more tangible example check this Q&A, in particular how the linked to researchers re-framed genetic data into a time-series problem; by being a bit flexible in mindset they where able to do some interesting things swiftly.


Hopefully with a little more information someone can come along and do better at providing a direct answer with less hand waving.


Updates

Okay so with the information now provided from your comments it almost sounds like you may want to train a network to train variations of network parameters. There's many ways that could be modeled; Neuroevolution, Genetic Evolution, etc. and ways of mitigating mutation could even be similar to pruning (or what I think of as intentional brain-damage) so that offspring networks don't get overly complex.

What I'm getting at is that cluster size, scaling factors, and other parameters maybe something that can be sorted through the use of a network higher in the stack that tries fiddling with things for ya; essentially it would be taking the model that you're already happy with, tweak some-thing about it a bit, inbreed those that preformed best, brain damage the mid-age offspring, and repeat.

Side note, if ya add more information (such as what I pointed out) to your question it'll definitely help those writing better answers than I.

$\endgroup$
  • $\begingroup$ My goal is: Split my dataset in order to have clusters with similar data using unsupervised learning. I have tested several algorithms, but hierarchical clustering with euclidean distance and average/complete methods is the one that fits better in my dataset so far. Actually it seems to work well, but there is a problem: I don't know the number of clusters in advance. $\endgroup$ – Mario Apr 19 at 9:39
  • $\begingroup$ In order to automate the process (needed) I'm currently testing 'NbClust' package to find a good method (metric) to find the "optimal number of clusters". For that, I noticed that need to scale well my dataset in order to get "good results". I already tried to scaled x1,x9 to [0,2] and x2...x8 to [0,1] and there are two metrics that are almost perfect. To be perfect the created clusters must have the same value (in column) in the X9 and X1. $\endgroup$ – Mario Apr 19 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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