category
stringclasses
107 values
title
stringlengths
15
179
question_link
stringlengths
59
147
question_body
stringlengths
53
33.8k
answer_html
stringlengths
0
28.8k
__index_level_0__
int64
0
1.58k
clustering algorithms
Why is UMAP used in combination with other Clustering Algorithm?
https://datascience.stackexchange.com/questions/120574/why-is-umap-used-in-combination-with-other-clustering-algorithm
<p>I've noticed that UMAP is often used in combination with other clustering algorithms, such as K-means, DBSCAN, HDBSCAN. However, from what I've understood, UMAP can be used for clustering tasks. So why I've noticed people using it primarily as a dimensionality reduction technique?</p> <p>Here an example of what I'm ...
<p>As mentioned Noe, UMAP is 100% for dimensional reduction, ONLY to group similar data and separate different ones, THEN we apply a clustering algorithm such as DBSCAN to identify those groups in the projected space.</p> <p>Multi-dimensional reduction is the most difficult part because you need to detect similarities ...
262
clustering algorithms
What clustering algorithm is appropriate for clustering paths?
https://datascience.stackexchange.com/questions/42166/what-clustering-algorithm-is-appropriate-for-clustering-paths
<p>I have a dataset with vectors in 2-dimensional space that form separate sequences (paths). Full data is presented below: <a href="https://i.sstatic.net/NRYF5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NRYF5.png" alt="enter image description here"></a>, while a random sample of 5 paths looks like ...
<p>Like Ricardo mentioned in his comment on your question, the main step here is finding a distance metric between paths. Then you can experiment with different clustering algorithms and see what works. </p> <p>What comes to mind is <a href="https://en.wikipedia.org/wiki/Dynamic_time_warping?oldformat=true" rel="nofol...
263
clustering algorithms
Conceptual question about cosine similarity and clustering algorithms for word embeddings
https://datascience.stackexchange.com/questions/107252/conceptual-question-about-cosine-similarity-and-clustering-algorithms-for-word-e
<p>Is the following statement true? <a href="https://stats.stackexchange.com/q/256778">https://stats.stackexchange.com/q/256778</a></p> <blockquote> <p>The value of cosine similarity between two terms itself is not indicator whether they are similar or not.</p> </blockquote> <p>If yes then how is use of clustering algo...
264
clustering algorithms
Clustering algorithm prior to model building?
https://datascience.stackexchange.com/questions/28639/clustering-algorithm-prior-to-model-building
<p>I would like to understand, how a clustering algorithm can be used (if possible) to identify naturally occurring groups within a data set, prior to building predictive models/model, and to hence improve accuracy of models/model</p>
<p>In clustering the outcome variable or the response is unknown, this is why it's called clustering. Irrespective, of the fact the data being labeled or unlabelled, clustering can be applied as a data preprocessing algorithm. Essentially, you must proceed by employing the initial data preprocessing tasks (like missing...
265
clustering algorithms
Clustering algorithms for datasets with enumerable but sometimes unknown features and unknown number of clusters
https://datascience.stackexchange.com/questions/131729/clustering-algorithms-for-datasets-with-enumerable-but-sometimes-unknown-feature
<p>I currently do have a dataset of datasets and do want to cluster the data in each dataset. Therefore I want to use a clustering algorithm ...</p> <p>As such the data in each dataset is a bit special and for example it looks like so:</p> <pre><code>Datapoints Attribute1 Attribute2 Attribute3 DataPoint1 A ...
266
clustering algorithms
How to add &#39;other&#39; as one group to clustering algorithm inference pipeline
https://datascience.stackexchange.com/questions/93264/how-to-add-other-as-one-group-to-clustering-algorithm-inference-pipeline
<p>I have few clustering algorithms tuned having 5 cluster. I want 6th cluster if new data does not belong initial 5 cluster fall in 6th cluster.</p> <p>6th cluster [ say other category] consist of all data point which does not belong to 5 cluster.</p> <p>P.S.:- initial whatever data is give is belong those 5 cluster...
<p>Clustering doesn't work like this: for example k-means assigns an instance to the closest centroid, and since there is always a closest centroid there is a always a cluster that an instance &quot;belongs to&quot;.</p> <p>So you need a different approach if you plan to have the possibility of in instance &quot;not in...
267
clustering algorithms
Is there a clustering algorithm that can cluster time series dataset based on variation ratio (or quantity)?
https://datascience.stackexchange.com/questions/44359/is-there-a-clustering-algorithm-that-can-cluster-time-series-dataset-based-on-va
<p>I am learning machine learning from scikit-learn and reading its docs.</p> <p>Clustering clusters groups based on the Euclidean distance and filters them by different ways ex: Gaussian distribution, or mean-shift...etc.</p> <p>But none of the clustering algorithms cluster samples based on the variation ratio.</p> <p...
<ol> <li>Extract features such as variation ratio</li> <li>Cluster the extracted features instead of the raw data</li> </ol>
268
clustering algorithms
Can I apply Clustering algorithms to the result of Manifold Visualization Methods?
https://datascience.stackexchange.com/questions/10974/can-i-apply-clustering-algorithms-to-the-result-of-manifold-visualization-method
<p>Some methods related to manifold-learning are commonly stated as <strong>good-for-visualization</strong>, such as T-SNE and self-organizing-maps (SOM).</p> <p>I understand that when referring specifically to "visualization" means that the non-linear dimensionality reduction can provide good insights of data in its ...
<p>You can do anything you want in the low dimensional space, and can try to validate as well. By clustering the above, you are in effect assigning features/tags to your data points in higher dimensions. Remember, tSNE tries to preserve distances, so that points in high dimensions will remain close to each other in low...
269
clustering algorithms
Is there a clustering algorithm which accepts some clusters as input and outputs some more clusters?
https://datascience.stackexchange.com/questions/84711/is-there-a-clustering-algorithm-which-accepts-some-clusters-as-input-and-outputs
<p>Heres the task: I have data I don't know much about. The final task is to build a classifier to classify the samples into a few categories. Some of the categories are pretty clear, we can easily use these as labels for a classifier. But I guess there are more useful categories possible, because right now <strong>mos...
<p>You are describing <a href="https://en.wikipedia.org/wiki/Semi-supervised_learning" rel="nofollow noreferrer">semi-supervised learning</a> where the training dataset is only partially labeled.</p> <p>One common set of techniques to solve that problem is <a href="https://en.wikipedia.org/wiki/Active_learning_(machine...
270
clustering algorithms
Algorithms for text clustering
https://datascience.stackexchange.com/questions/979/algorithms-for-text-clustering
<p>I have a problem of clustering huge amount of sentences into groups by their meanings. This is similar to a problem when you have lots of sentences and want to group them by their meanings.</p> <p>What algorithms are suggested to do this? I don't know number of clusters in advance (and as more data is coming cluster...
<p>Check the <strong><a href="http://www-nlp.stanford.edu/software" rel="nofollow noreferrer">Stanford NLP Group</a></strong>'s open source software, in particular, <strong><a href="http://www-nlp.stanford.edu/software/classifier.shtml" rel="nofollow noreferrer">Stanford Classifier</a></strong>. The software is written...
271
clustering algorithms
Clustering algorithm to sort filenames
https://datascience.stackexchange.com/questions/28022/clustering-algorithm-to-sort-filenames
<p>A client would like to sort out his filesystem (~ 1,000,000,000 files), which has been fed by numerous workers over the years, each with their own unknown naming convention, e.g.:</p> <ul> <li>[DATE]-[CLIENT]-[FILENAME]</li> <li>[TYPE]-[CLIENT].[DATE][FILENAME]</li> <li>...</li> </ul> <p>Here are four examples (ou...
<p>For those interested in a solution for similar problems, I found a solution with these steps:</p> <ol> <li><p>Splitting the filenames on "_", generating n strings</p></li> <li><p>Taking the length of each string</p></li> <li><p>Running KMeans (optimal K using Gap Statistics)</p></li> <li><p>Taking one sample per cl...
272
clustering algorithms
Should a Cluster Validity Index contain the same measure(s) as the Clustering Algorithm?
https://datascience.stackexchange.com/questions/52766/should-a-cluster-validity-index-contain-the-same-measures-as-the-clustering-al
<p>I'm currently trying to use cluster analysis as a tool for time-series aggregation for a project of mine. The dataset is high-dimensional (386-d), so no chance in assessing the cluster validity visually.</p> <p>I'm using three different clustering algorithms (k-means++, k-medoids PAM, fuzzy c-means) to find represe...
<p>It's standard to use, e.g., Silhouette to assess the quality of clusterings, that were obtained with other methods.</p> <p>I'm not a big fan of this (people always think they would get the "optimal" result this way, but they don't), but it's all over literature. Logically, you are trying to maximizing Silhouette an...
273
clustering algorithms
Looking for a clustering algorithm for highly noisy data
https://datascience.stackexchange.com/questions/113940/looking-for-a-clustering-algorithm-for-highly-noisy-data
<p>I am trying to find clusters in some data with high noise (see plot below, data <a href="https://pastebin.com/asADpJ0Y" rel="nofollow noreferrer">here</a>).</p> <p><a href="https://i.sstatic.net/GMnpj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GMnpj.png" alt="enter image description here" /></a><...
<p>It could be interesting to reduce noise (=smoothing) as much as possible before applying a clustering algorithm.</p> <p>Furthermore, periodic boundaries that have too many values may alter results, and that's why it could be a good option to simplify values when it is possible.</p> <p>If non of the previous options ...
274
clustering algorithms
K-means Clustering algorithm problems
https://datascience.stackexchange.com/questions/13200/k-means-clustering-algorithm-problems
<p>I am trying to implement k-means clustering algorithm, but I am confused about calculating the distance and update(move) cluster centroids. For example, let's say that I have 2 features. One of them is <code>weight={2,4,6,8,11,14,21}</code> and the other one is <code>height={4,6,7,8,9,12,14}</code>. So, in the coord...
<p>Wikipedia says: "Assign each observation to the cluster whose mean yields the least within-cluster sum of squares (WCSS)"</p> <p>I think in your case, this is translatable to: $c_i$ is assigned to the closest centroid by euclidean distance.</p> <p>For your second question, the centroid should $\mu$ should have the...
275
clustering algorithms
best clustering algorithm or model for clustering areas on map?
https://datascience.stackexchange.com/questions/114367/best-clustering-algorithm-or-model-for-clustering-areas-on-map
<p>I have a database that has information such as Latitude, longitude, plus other information such as sightseeing locations, restaurants and shopping centers, if it's rural or suburb,... It also has grids and centroids for each grid on the map. I need to cluster the area based on similarities, so when someone is drivin...
<p>It seems to me there won't be 1 exact best fit algorithm for your case, at least how you framed your question currently. You could load your data into a software kit specifically meant for analysing graph data like Neo4j or Gephi keeping the lat., lon., grid and centroid info and then evaluate how the data clusters ...
276
clustering algorithms
Clustering algorithm which does not require to tell the number of clusters
https://datascience.stackexchange.com/questions/66140/clustering-algorithm-which-does-not-require-to-tell-the-number-of-clusters
<p>I have a dataframe with 2 columns of numerical values. I want to apply a clustering algorithm to put all the entries into the same group, which have a relatively small distance to the other entries. But which clustering algorithm can I use, although I do not know how many groups will be formed? It would be ideal if ...
<p>I'd suggest looking at <a href="https://en.wikipedia.org/wiki/Hierarchical_clustering" rel="nofollow noreferrer">hierarchical clustering</a>:</p> <ul> <li>It's simple so you could implement and tune your own version</li> <li>It lets you decide at which level you want to stop grouping elements together, so you could...
277
clustering algorithms
Appropriate Clustering Algorithm
https://datascience.stackexchange.com/questions/19443/appropriate-clustering-algorithm
<p>I need to find a good clustering for this data using sci-kit. </p> <p><a href="https://i.sstatic.net/AZnRG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AZnRG.png" alt="enter image description here"></a></p> <p>KNN is not appropriate as it creates blobs although these data are linearly separated. ...
<p>I'd rather not rely on clustering (clearly, DBSCAN would be the first method to try).</p> <p>Instead, I'd look for a <em>projection</em> that removes the correlation (x - y maybe?), then define a grid to separate the data.</p>
278
clustering algorithms
Is there an oriented clustering algorithm?
https://datascience.stackexchange.com/questions/41520/is-there-an-oriented-clustering-algorithm
<p>I'm looking for a clustering algorithm that will make cluster depending on a orientation. The DBSCAN algorithm cluster points based on a constant radius :</p> <p><a href="https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/DBSCAN-Illustration.svg/800px-DBSCAN-Illustration.svg.png" rel="nofollow noreferrer">htt...
<p>If I remember correctly, non-negative matrix factorization (NMF) can be used as a clustering approach that can recover clusters that are along vectors, for example. It may work for your dataset. It factors a data matrix <span class="math-container">$D \in \mathbb{R}^{m * n}$</span> into two matrices <span class="mat...
279
clustering algorithms
What methods are available to evaluate similarity between different clustering algorithms?
https://datascience.stackexchange.com/questions/75923/what-methods-are-available-to-evaluate-similarity-between-different-clustering-a
<p>I am performing extensive customer segmentation analysis and so far implemented Gaussian Mixture Models, K-Means, and Hierarchical Clustering. For the most part, the algorithms agree on the structure of the clusters and well as the number (7-8). I would like to know if there is a common method to either...</p> <ul>...
<p>If you just want to see how similar the clustering is between 2 algorithms, using the sklearn.metrics.adjusted_rand_score() function is a good starting point. This will work for unsupervised learning, no need for a label.</p> <p><a href="https://scikit-learn.org/stable/modules/generated/sklearn.metrics.adjusted_ran...
280
clustering algorithms
Are there algorithms for clustering objects with pairwise distances, without computing all pairwise distances?
https://datascience.stackexchange.com/questions/46950/are-there-algorithms-for-clustering-objects-with-pairwise-distances-without-com
<p>I'm looking for a clustering algorithm that clusters objects, by using their pairwise distances, without needing to calculate all pairwise distances.</p> <p><strong>Normally pairwise clustering is done like this:</strong> (see <a href="https://datascience.stackexchange.com/questions/701/clustering-pair-wise-distanc...
<p>Well, one may argue that DBSCAN is based on all pairwise distances, but it uses data indexing to avoid computing all of them using geometric bounds.</p> <p>And there are other examples if you browse through literature.</p> <p>For example, the classic CLARA method is an approximation to PAM that avoids computing al...
281
clustering algorithms
Deep Continious Clustering algorithm - just one output cluster
https://datascience.stackexchange.com/questions/82847/deep-continious-clustering-algorithm-just-one-output-cluster
<p>I use the DCC algorithm to cluster some data. The whole algorithm is available here, but shortly it is:</p> <ol> <li>construct mkNN graph of the data points (the connected components of it are the clusters).</li> <li>pretrain an Autoencoder for data dimension-reduction.</li> <li>train the Autoencoder witn it's objec...
282
clustering algorithms
Notion of cluster centers and cluster comparison in Density Based Algorithms
https://datascience.stackexchange.com/questions/20471/notion-of-cluster-centers-and-cluster-comparison-in-density-based-algorithms
<p>I have done some research on clustering algorithms since for my goal is to cluster noisy data and identify outliers or small clusters as anomalies. I consider my data noisy because of my main feautures can have quite varying values. Therefore, my focus has been on density based algorithms with quite some success.</p...
<p>You can either use the medoid, you can sometimes compute a centroid (and just ignore that it may be outside of the cluster), or you can do pairwise comparisons and take the average of that rather than comparing centers.</p>
283
clustering algorithms
Best clustering algorithm to identify clusters and determine the closet cluster each individual response is near?
https://datascience.stackexchange.com/questions/65925/best-clustering-algorithm-to-identify-clusters-and-determine-the-closet-cluster
<p>I have a survey where each question is related to a different 'shopper' type (there are 5 types so 5 questions). Each question is either binary (True/False) or scale based.</p> <p>IE:</p> <pre><code>1. Do you like to shop at our physical location store ? (True/False) 2. Do our discounts entice you to shop more? a...
<p>Since they are categorical variables, I would cluster them using the <strong>k-medoids clustering method</strong>. Before applying this method, one-hot encode all the predictors.</p> <p>See a tutorial here: <a href="https://towardsdatascience.com/k-medoids-clustering-on-iris-data-set-1931bf781e05" rel="nofollow nor...
284
clustering algorithms
Is there any method to determine which clustering algorithm to use on a particular dataset?
https://datascience.stackexchange.com/questions/56638/is-there-any-method-to-determine-which-clustering-algorithm-to-use-on-a-particul
<p>I'm having a hard time getting kmeans to cluster data effectively. It fails to segment data well even for a simple attribute with 5 categories. I'm aware of DBSCAN, Hierarchical Clustering and GMM. However, just wanted to know if there's any way (visual or otherwise) to narrow down the clustering algorithm which mig...
<p>No.</p> <p>Clustering is an explorative technique, it is subjective what is good, and the best clusters are those that are "interpretable but unexpected", a property that you cannot quantity with statistics. So it is a trial-and-error <em>task</em>.</p> <p>Furthermore, <strong>data preparation is much more importa...
285
clustering algorithms
Are there any algorithms for solid polygon clustering?
https://datascience.stackexchange.com/questions/56565/are-there-any-algorithms-for-solid-polygon-clustering
<p>I'm looking for something like K-Means for dividing solid polygons into regions. K-Means clusters discrete points. But I want to cluster (that is, partition) the points of solid polygons.<a href="https://i.sstatic.net/43RD0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/43RD0.png" alt="expected polyg...
<p>Finally I just implemented solution as I planned and described it in <a href="https://medium.com/@trechkalov/reinventing-wheel-naive-way-to-wireless-sensor-network-coverage-optimization-de59868c787b" rel="nofollow noreferrer">Medium post</a>. This is &quot;K-Means for solid polygons&quot;. I made a playground on my ...
286
clustering algorithms
Built a Heap in Cluster algorithm
https://datascience.stackexchange.com/questions/15116/built-a-heap-in-cluster-algorithm
<p>Does anyone could explain in details how heap structure works in Cluster Algorithm?</p> <p>I am planning to code CURE in Matlab (Clustering using representatives) but, at first, the paper mentions that all points of datasets are considerered as clusters and heap helps to merge new clusters and I do not know how exa...
<p>A heap works in clustering the same way it works outside of clustering.</p> <p>It's purpose is to efficiently find the minimum or maximum of a set, remove it, then find the next.</p> <p>Efficient implementations of heaps in scripting languages may be impossible. For good performance, you usually need low-level mem...
287
clustering algorithms
Seeking Appropriate Clustering Algorithm
https://datascience.stackexchange.com/questions/17109/seeking-appropriate-clustering-algorithm
<p>I'm analyzing the GDELT dataset and I want to determine thematic clusters. Simplifying considerably, GDELT parses news articles and extracts events. As part of that, it recognizes, let's say, 250 "themes" and tags each "event" it records in a column a semi-colon separated list of all themes identified in the article...
288
clustering algorithms
Cluster algorithm to group events in more general domains
https://datascience.stackexchange.com/questions/28711/cluster-algorithm-to-group-events-in-more-general-domains
<p>I've a list of 1,300 news events, represented by only three terms coming from running LDA topic model on thousands of tweets. Here's some of them as an example:</p> <pre><code>['manchester,bony,city', 'attack,claims,responsibility', 'police,officers,nypd', 'goal,arsenal,liverpool', 'test,pakistan,sunday', 'obama,u...
<p>Some creative post-processing can be done. For instance applying <a href="https://en.wikipedia.org/wiki/Named-entity_recognition" rel="nofollow noreferrer">Named Entity Recognition</a> and simplify some parts (<strong>Manchester</strong> is a <strong>City</strong>). Using Knowledge Graph Analysis also gives some met...
289
clustering algorithms
Which clustering/partitioning algorithms can operate on arbitrary pairwise similarity or distance matrices?
https://datascience.stackexchange.com/questions/112186/which-clustering-partitioning-algorithms-can-operate-on-arbitrary-pairwise-simil
<p>I'm relatively new to cluster analysis, and I'm exploring options for general-purpose, non-hierarchical, strict partitioning of data based on a pre-computed <span class="math-container">$N\times N$</span> pairwise similarity matrix. The matrix must be computable from an arbitrary user-specified (i.e., non-canned) s...
290
clustering algorithms
What is the advantage of using Dunn index over other metrics for evaluating clustering algorithm?
https://datascience.stackexchange.com/questions/27978/what-is-the-advantage-of-using-dunn-index-over-other-metrics-for-evaluating-clus
<p>There are many metrics to evaluate clustering algorithm like Calinski-Harabaz Index, Dunn index, Rand index, etc. Are there any advantage of using Dunn index over other metrics for evaluating clustering algorithm (K-means in particular)? If yes, what are the advantages and disadvantages?</p>
<p>They will often give the same preferences.</p> <p>Do not forget that these are largely <strong>heuristics</strong>. They won't have much advantages over one another. That is why there are so many.</p> <p>As a guideline, look at the definitions. Choose that index, whose equation is most relevant for your problem. (...
291
clustering algorithms
Graph Clustering algorithms when both nodes *and* edges have features (numerical, categorical and potentially even temporal!)
https://datascience.stackexchange.com/questions/124702/graph-clustering-algorithms-when-both-nodes-and-edges-have-features-numerical
<p>I'm trying to figure out how much complexity I can get away with and am looking for model recommendations.</p> <p>I have transactional data on hand - the features being customer id, customer balance, transaction amount, transaction date/time, receiver id (possibly a company), company_type (if a company).</p> <p>So I...
292
clustering algorithms
Which Clustering algorithm to use for unique 4Dimension dataset before feeding to correlation?
https://datascience.stackexchange.com/questions/17997/which-clustering-algorithm-to-use-for-unique-4dimension-dataset-before-feeding-t
<p>Lets give an example <code>X: 1 2 3 4 5 Y: .9 .91 .92 .93 .94 Z: 20 36 999 211 M. 4000 3456 1 0</code></p> <p>When I have such dataset, Which clustering algorithm to choose ? Also, How to interpret the results after clustering ? Meaning: How to feed 4D dataset into cluster.</p> <p>I found DBSCAN available on inter...
<p>DBSCAN is not limited to 2d (apparently you only found very bad implementations) and can be used with correlation distance, too. </p> <p>But mostly, you need to focus on preprocessing.</p> <p>If you intend to do correlation anyway, you should consider to z normalize your input data, I.e. <code>x'= (x - mean(x))/st...
293
clustering algorithms
What is the Space &amp; Time Complexity of Mini-Batch K-Means clustering algorithm?
https://datascience.stackexchange.com/questions/19042/what-is-the-space-time-complexity-of-mini-batch-k-means-clustering-algorithm
<p>For vanilla K-Means clustering algorithm I know that the time complexity is:</p> <blockquote> <p>Time complexity: O(tknm),</p> </blockquote> <p>where n is the number of data points, k is the number of clusters, and t is the number of iterations, m is the dimensionality of the vectors. </p> <p>So, when I studied...
<p>Infinite.</p> <p>Mini-batch k-means never converges, you need to use an iteration limit or similar heuristic, and you can never guarantee to have found a local optimum.</p> <p>In essence, mini-batch k-means is:</p> <ol> <li>draw a random sample</li> <li>perform one iteration of k-means using this sample</li> <li>...
294
clustering algorithms
How to implement Brown Clustering Algorithm in O(|V|k^2)
https://datascience.stackexchange.com/questions/896/how-to-implement-brown-clustering-algorithm-in-ovk2
<p>I am trying to implement the Brown Clustering Algorithm.</p> <p><strong>Paper details: "Class-Based n-gram Models of Natural Language" by Brown et al</strong></p> <p>The algorithm is supposed to in <code>O(|V|k^2)</code> where <code>|V|</code> is the size of the vocabulary and k is the number of clusters. I am una...
<p>I have managed to resolve this. There is an excellent and thorough explanation of the optimization steps in the following thesis: <a href="http://cs.stanford.edu/~pliang/papers/meng-thesis.pdf" rel="nofollow">Semi-Supervised Learning for Natural Language by Percy Liang</a>.</p> <p>My mistake was trying to update th...
295
clustering algorithms
Looking for an algorithm which does Max Sum Clustering
https://datascience.stackexchange.com/questions/50933/looking-for-an-algorithm-which-does-max-sum-clustering
<p>I have a very limited background in data science and dataset processing and I was hoping I could get some help here. I am doing some work that requires clustering certain data points having <span class="math-container">$(x, y)$</span> position values and associated weight <span class="math-container">$W_i$</span> fo...
<p>Modify existing algorithms as necessary.</p> <p>Tutorial example: <a href="https://elki-project.github.io/tutorial/same-size_k_means" rel="nofollow noreferrer">https://elki-project.github.io/tutorial/same-size_k_means</a></p> <p>This should also work if the desired clusters don't have the same weight sum as far as...
296
clustering algorithms
How to apply multiple clustering algorithms to same dataset and make comparison?
https://datascience.stackexchange.com/questions/81804/how-to-apply-multiple-clustering-algorithms-to-same-dataset-and-make-comparison
<p>I've a dataset and I want to implement K-Means, Fuzzy C Means, Gaussian Mixture Model, Spectral Graph. After that, I want to see the clusters that I get from different methods. What is the proper way to do that? Or should I only stick one algorithm and try to maximize correctness of that clustering?</p>
<p>Have a look at the scikit learn API, they have a <a href="https://scikit-learn.org/stable/modules/clustering.html" rel="nofollow noreferrer">section</a> dedicated to this topic.</p> <p>If you want to go further, have a look at chapter 3 &quot;Unsupervised Learning and Preprocessing&quot; of the book <strong>Introduc...
297
clustering algorithms
How can I reduce the number of dimensions using a Clustering algorithm in a mixed dataset?
https://datascience.stackexchange.com/questions/93912/how-can-i-reduce-the-number-of-dimensions-using-a-clustering-algorithm-in-a-mixe
<p>I am working with a mixed data set, corresponding to TV consumption data, with the aim of reducing the number of features to only those relevant to detect TV consumption patterns (or consumption groups) using clustering.</p> <p>The dataset is composed of about 20 dimensions and 2.000.000 samples for 1 day of consump...
<p>Some common techniques to reduce number of features:</p> <ul> <li><p>Missing Values Ratio. Data columns with too many missing values are unlikely to carry much useful information. Thus data columns with number of missing values greater than a given threshold can be removed. The higher the threshold, the more aggress...
298
clustering algorithms
Clustering a labeled data set
https://datascience.stackexchange.com/questions/31975/clustering-a-labeled-data-set
<p>I have a large labeled dataset with 29 classes. Is is possible to use a clustering algorithm (like k-means) in this dataset, or it's not possible since clustering algorithms are unsupervised ? </p>
<p>You can do many things:</p> <ul> <li>Forget about the labels: just use the features that are not labels and cluster along those features using the k-means algorithm (or another).</li> <li>Forget about the features: this is the dummiest way of clustering. Cluster the data in 29 clusters according to the labels that ...
299
decision trees
Weka class attribute suggestion
https://datascience.stackexchange.com/questions/6316/weka-class-attribute-suggestion
<p>We are trying to run J48 on a classified data set. Our class attribute has two possible values ( 0,1) when running J48 the tree terminates at the very first node and doesnt process any further.</p> <p>Instead of considering (0- false) as the starting point of J48. How can we consider running J48 by selecting (1-tru...
<p>I am assuming that you have only 1 attribute (numeric). What you can do is </p> <ol> <li>modify the .arff file and set 0s to 1 and 1s to 0.</li> <li>Then you can again run j48 classifier and visualise the decision tree.</li> </ol> <p>It would give you inverted result. Also, try watching this video.<a href="https:/...
300
decision trees
Pruning tree using REP
https://datascience.stackexchange.com/questions/10115/pruning-tree-using-rep
<p>i create a decision tree model using c4.5 algorithm. After create the model, i evaluate model using 10 fold cross validation and classify model using test data to get accuracy. And then I run prune tree with REP. </p> <p>My question is what data should i use to compare accuracy (after prune and before prune) to dec...
<p>The reduce error pruning strategy works in the following way:</p> <ol> <li>Train a tree on a training data set</li> <li>Fit a pruning data set (which is different than the training data set) to the tree. What you will have is the tree as was learned at step one, but for each node you will have some instances from t...
301
decision trees
How can decision trees be tuned for non-symmetrical loss?
https://datascience.stackexchange.com/questions/11379/how-can-decision-trees-be-tuned-for-non-symmetrical-loss
<p>Suppose we use a decision tree to predict if a bank customer can pay back a credit. So it is a two class classification problem. Now we can make two mistakes:</p> <ul> <li>$\alpha$ error: The customer can back the credit, but we predict he can't.</li> <li>$\beta$ error: The customer can't pay back the credit, but w...
<p>Theoretically, decision tree algorithms specify the feature as well as the threshold that maximize the separation between classes at each node. This can be done by solving optimization problem related to the entropy at the children nodes. You can modify this optimization problem by including the miss- classificatio...
302
decision trees
Decision Stumps with same value leaf nodes
https://datascience.stackexchange.com/questions/11752/decision-stumps-with-same-value-leaf-nodes
<p>I'm doing some ADA boosting with Decision stumps and in inducing a binary classifying decision stump, i'm finding both leaf nodes to have a positive value. Can this be the case? Is this possible?</p>
<p>What is the overall response rate? If it's low (even 15-20%) it may be difficult to find decision stumps that contain one leaf with > 50% response! </p> <p>You could consider oversampling or changing cutoff probability, but I think if your using only 2 leaf trees, your model is bound to struggle.</p>
303
decision trees
Forecasting: How Decision Tree work?
https://datascience.stackexchange.com/questions/24167/forecasting-how-decision-tree-work
<p>For example I have the following data structure:</p> <pre><code>user: Chris age: 32 income: 60.000 basket value: 45 </code></pre> <p>I want predict the basket value, and my features are the age and income.</p> <p>With a linear regression I get a regression function as the result of the fitting for example: $$y = ...
<p>Yes. It is also a function, but not an affine transformation of the input but a relatively complex sum of products of indicator functions of the input. Usually, this function is represented by the fitted tree and not as a formula.</p> <p>So e.g. if you learn a tree of depth one and the split is at age 40 with mean ...
304
decision trees
Difference between impurity and misclassificaton
https://datascience.stackexchange.com/questions/31535/difference-between-impurity-and-misclassificaton
<p>I am reading the gini index definition for decision tree: </p> <pre><code>Gini impurity is a measure of how often a randomly chosen element from the set would be incorrectly labeled if it was randomly labeled according to the distribution of labels in the subset. </code></pre> <p>This seems to be the same as mis...
<blockquote> <p>Is Gini index just a fancy name for misclassification?</p> </blockquote> <p>No.</p> <p>Note that Gini index definition doesn't involve predicted values, and also it involves some probabilities, which are not dependent on classifier.</p> <p>Also in context of decision trees, Gini impurity correspond...
305
decision trees
Compile See5 / C50 GPL Edition
https://datascience.stackexchange.com/questions/47309/compile-see5-c50-gpl-edition
<p>See5 / C5.0 is Data Mining Tools available from <a href="https://www.rulequest.com/see5-info.html" rel="nofollow noreferrer">rulequest</a></p> <p>I want to compile C50 for Linux, preferably for CentOS 6.x, but I am unable to compile. I have also tried on Ubuntu, but not success there as well. </p> <p>I have downlo...
<p>After extracting <code>C50.tgz</code> file, give execution rights to <code>Makefile</code>.</p> <pre><code>chmod +x Makefile </code></pre> <p>Then install csh</p> <pre><code>sudo apt install csh </code></pre> <p>Run below command to check if csh is install and check csh version (if installed)</p> <pre><code>dpk...
306
decision trees
Number of iterations for minimal cost complexity prunning?
https://datascience.stackexchange.com/questions/48789/number-of-iterations-for-minimal-cost-complexity-prunning
<p>I've been fiddling with weka's J48 decision tree implementation (C4.5). My goal is to implement cost complexity prunning using weakest link cut method. Basically my algorithm iteratively prunes the tree creating trees with fewer nodes from the previous ones (<span class="math-container">$ T_0 &gt; T_1 &gt; T_2 &gt;....
307
decision trees
How should a decision tree handle an attribute that can be anything?
https://datascience.stackexchange.com/questions/55862/how-should-a-decision-tree-handle-an-attribute-that-can-be-anything
<p>Say I have AttributeA that can take values A1, A2, A3, AttributeB that can take values B1, B2, B3, etc. and I know ahead of time that my classification table looks like</p> <p>AttributeA | AttributeB | AttributeC | Classification</p> <p>A1 | B1 | anything | Class 1</p> <p>anything | B2 | anything | Class 2</p> <...
<p>I think your description of anything matches the idea of missing values. Basically by stating that a value could take any value you say that you do not know the value. In standard Breiman description of CART or random forests there is a way to handle missing values. If you use Python stack, however, the implementati...
308
decision trees
Ordinal features to decision tree in Python
https://datascience.stackexchange.com/questions/58745/ordinal-features-to-decision-tree-in-python
<p>I have a data set with ordinal features.Each feature might have 6 to 7 levels. Based on my search for R if you have ordinal data, rpart treats ordinal and nominal differently. <a href="https://stats.stackexchange.com/questions/94502/decision-tree-splitting-factor-variables">https://stats.stackexchange.com/questions/...
<p>Ordinal variables are treated exactly the same as numerical variables by decision trees. (And so, you might as well encode them as consecutive integers.)</p> <p>As for (unordered) categorical variables, LightGBM (and maybe H2O's GBM?) supports the optimal <code>rpart</code>-style splits [using the response-orderin...
309
decision trees
Continuous decision trees using logistic functions
https://datascience.stackexchange.com/questions/61382/continuous-decision-trees-using-logistic-functions
<p>Decision tree functions are discontinuous functions of the predictors. Have continuous decision trees with smooth transitions been studied? For example, a decision tree in two variables</p> <pre><code>f(x1,x2) = c1 if x1 &lt; t1 and x2 &lt; t2 c2 if x1 &lt; t1 and x2 &gt;= t2 c3 if x1 &gt;=...
310
decision trees
What are the ways to identify a good attribute test while constructing a decision tree?
https://datascience.stackexchange.com/questions/63253/what-are-the-ways-to-identify-a-good-attribute-test-while-constructing-a-decisio
<p>I'm working through a decision tree by hand to learn it. From my research, I have found the following three ways of determining which variables to split on:</p> <ol> <li>Minimum remaining values - The variable with the fewest legal values is chosen</li> <li>Degree heuristic - The variable with the most constraints ...
<p>You might have mixed up CSP (Constrained Satisfaction Problem) search trees and decision trees:</p> <p><strong>CSP search trees</strong></p> <p>'Minimum remaining values', 'Degree Heuristic' and 'Least Constraining Value' are used to solve CSPs and not in decision trees (i.e. we are talking symbolic AI here and no...
311
decision trees
DecisionTreeClassifier Integer Conditions, Integer Outcome Variable
https://datascience.stackexchange.com/questions/64450/decisiontreeclassifier-integer-conditions-integer-outcome-variable
<p>Vague condition: "NumGoals >= 1.23" </p> <p>Preferred condition: "NumGoals > 1".</p> <p>Switched normalization off.</p> <p>Code:</p> <pre><code>from sklearn.datasets import load_iris from sklearn.tree import DecisionTreeClassifier, plot_tree import matplotlib.pyplot as plt import numpy as np iris = load_iris() ...
312
decision trees
Numeric variables in Decision trees
https://datascience.stackexchange.com/questions/71678/numeric-variables-in-decision-trees
<p>If we have numeric variable, decision trees will use <code>&lt;</code> and <code>&gt;</code> comparisons as splitting criteria. Lets consider this case : If our target variable is <code>1</code> for even numeric value, and <code>0</code> for odd numeric value. How to deal with this type of variables? How to even ide...
<p>I would call this bad feature engineering, I'm afraid: as the designer of a ML system, one is supposed to analyze their data and find the best way to make the ML system perform as well as possible. In this case by adding a simple feature <code>x % 2</code> for every instance the decision tree can perform perfectly.<...
313
decision trees
Decision tree on big categorical dataset
https://datascience.stackexchange.com/questions/74675/decision-tree-on-big-categorical-dataset
<p>I would like to use algorithm ID3 in order to find a decision tree of my <a href="https://www.kaggle.com/rtatman/chocolate-bar-ratings" rel="nofollow noreferrer">dataset</a>. I would like to see which of the attributes and values lead to the different value of rating (1&lt;= x &lt;= 5). Do you think it is possible t...
<p>You can see this dataset as a regression problem and not a classification one. The label is ordered, so predicting 2.8 is not a mistake, it is just that it is close to 3 (satisfactory but not there).</p> <p>I can suggest to start with a regression tree and then round the results to have integers.</p> <p>Also you c...
314
decision trees
Strings/ features in Turicreate decision tree
https://datascience.stackexchange.com/questions/87391/strings-features-in-turicreate-decision-tree
<p>I am trying to create a prediction model by using a decision tree with Turicreate. While my problem does involve numbers, it also involves strings and ultimately I want it to return the string 'true/false'. Are Turicreate decision trees able to process strings as input and output?</p>
<p>I'm not familiar with the package, but <a href="https://apple.github.io/turicreate/docs/userguide/supervised-learning/linear-regression.html" rel="nofollow noreferrer">the documentation</a> suggests that strings as input will be handled internally by dummy-encoding (with a reference level). The linked section is fo...
315
decision trees
How to (better) discretize continuous data in decision trees?
https://datascience.stackexchange.com/questions/18156/how-to-better-discretize-continuous-data-in-decision-trees
<p>Standard decision tree algorithms, such as ID3 and C4.5, have a brute force approach for choosing the cut point in a continuous feature. Every single value is tested as a possible cut point. (By tested I mean that e.g. the Information gain is calculated at every possible value.)</p> <p>With many continuous features...
<p>No, you probably don't want to try all possible cut points in a serious implementation. That's how we describe it in simple introductions to ID3, because it's easier to understand, but it's typically not how it is actually implemented, because it is slow. In particular, if there are $n$ data points, then you'll ne...
316
decision trees
Computational vs intuitionistic or expert-based information gain in decision trees?
https://datascience.stackexchange.com/questions/97725/computational-vs-intuitionistic-or-expert-based-information-gain-in-decision-tre
<p>Computational vs intuitionistic or expert-based information gain in decision trees?</p> <p>This confuses me.</p> <p>Plenty of literature on how information gain can be used when it's calculated computationally. But what if there's a competing sense of &quot;intuitionistic (or expert-based) information importance&quo...
<p>The core principle in supervised machine learning is that the training data is a representative sample of the true distribution (i.e. the possibly infinite full set of instances that could happen).</p> <p>Under this assumption, the intuition and the numerical information gain (or other statistical measure) are expec...
317
decision trees
Gini Index in Regression Decision Tree
https://datascience.stackexchange.com/questions/35672/gini-index-in-regression-decision-tree
<p>I want to implement my own version of the CART Decision Tree from scrach (to learn how it works) but I have some trouble with the Gini Index, used to express the purity of a dataset.</p> <p>More precisely, I don't understand how Gini Index is supposed to work in the case of a regression tree.</p> <p>The few descri...
<p>In regression trees, sum of squared error (<strong>SSE</strong>) is the criterion for tree split. The first split is based on the feature/predictor and its values in your training set that yields the <strong>lowest SSE</strong> value. And then so on for the further splits.</p>
318
decision trees
Where can I find the original CART(classification and regression trees) published paper?
https://datascience.stackexchange.com/questions/106614/where-can-i-find-the-original-cartclassification-and-regression-trees-publishe
<p>I was trying to find the original CART paper. I found papers like <a href="https://www.researchgate.net/publication/227658748_Classification_and_Regression_Trees" rel="nofollow noreferrer">https://www.researchgate.net/publication/227658748_Classification_and_Regression_Trees</a> which experimented on CART but was un...
319
decision trees
Identifying subsets of values significant to the total sum
https://datascience.stackexchange.com/questions/110370/identifying-subsets-of-values-significant-to-the-total-sum
<p>Imagine a set of products in a store, with all the different attributes assigned to them - some of these hierarchical (e.g. categories), and some not (e.g. brand), but none of them continuous (if that is even important here). For each product, we know how much (in money-value) we've sold last year, and how much we s...
<p>I think ML is not needed here, as it is an SQL (or at least pandas) exercise. Namely, you have change in sales for each of the lowest level labels. You also have hierarchical relationship between labels Smartphones -&gt; Apple Smartphones -&gt; iPhone 2. So you basically need to aggregate from lower to higher label ...
320
decision trees
Decision tree question in R
https://datascience.stackexchange.com/questions/111697/decision-tree-question-in-r
<p>After training and testing the decision tree model, it always gives me the same outcome on any given data. Im talking about a binary classification yes or no. Basically when I do predict(fit_model, newdata=new_data) I always get no regardless the data I give. The model is quite simple and I can compute the outcome e...
321
decision trees
How to implement an oblique decision tree for regression?
https://datascience.stackexchange.com/questions/93520/how-to-implement-an-oblique-decision-tree-for-regression
<p>There are numerous ways to induce an oblique decision tree in the decision tree induction domain, such as using a support vector machine to determine the best hyper-plane. However, is it possible to generate an oblique decision tree for regression? I discovered that the majority of existing literature has omitted th...
322
decision trees
Tree based feature transformation
https://datascience.stackexchange.com/questions/94322/tree-based-feature-transformation
<p>I'm new to data science field and interested in performing prediction using clickstream data. In <a href="https://quinonero.net/Publications/predicting-clicks-facebook.pdf" rel="nofollow noreferrer">Practical Lessons from Predicting Clicks on Ads at Facebook</a> paper section 3.1, a method called Decision Tree Featu...
<p>What the article mentions is random tree embeddings.</p> <p>This is a kind of unsupervised feature extraction method based on random trees.</p> <p>In python you can find the Scikit-learn implementation.</p> <p>From the <a href="https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomTreesEmbedding.h...
323
decision trees
Can gradient boosted trees fit any function?
https://datascience.stackexchange.com/questions/32796/can-gradient-boosted-trees-fit-any-function
<p>For neural networks we have the <a href="https://en.wikipedia.org/wiki/Universal_approximation_theorem" rel="noreferrer">universal approximation theorem</a> which states that neural networks can approximate any continuous function on a compact subset of $R^n$.</p> <p>Is there a similar result for gradient boosted t...
<p>Yes - create a region for each data point (i.e., memorize the training data).</p> <p>Thus it is possible for gradient boosted trees fit any training data, but it would have limited generalization to new data.</p>
324
decision trees
What is the differences in the Gini Index, Chi-Square, and Information Gain splitting methods?
https://datascience.stackexchange.com/questions/48560/what-is-the-differences-in-the-gini-index-chi-square-and-information-gain-spli
<p>I am looking through decision trees, and I do not understand what makes each of these methods different. Could someone explain clearly what the difference between these is? Thank you.</p>
<p>As I understand it, all three want to minimize the false classified data points in your data set. (Logically, if you look for what decision trees are used)</p> <p>But each of them comes from another side to this problem.</p> <p><strong>gini impurity wants "better as random"</strong></p> <p>It compares the "I labe...
325
decision trees
Why is not AUC or other metrics used for splitting nodes in decision trees?
https://datascience.stackexchange.com/questions/51039/why-is-not-auc-or-other-metrics-used-for-splitting-nodes-in-decision-trees
<p>There are common ways to split a tree in decision trees and all their variants:</p> <ul> <li>Gini Index</li> <li>Entropy</li> <li>Misclassification</li> </ul> <p>Why there is not a method which uses directly AUC or accuracy (or whichever the modeler need) to split the nodes.</p> <p>Is it because of common use, or...
<p>On accuracy:<br> <a href="https://datascience.stackexchange.com/questions/14433/why-we-use-information-gain-over-accuracy-as-splitting-criterion-in-decision-tre">Why we use information gain over accuracy as splitting criterion in decision tree?</a></p> <p>AUC has been explored; it seems to work well, but is slower:...
326
decision trees
How often do we use m-ary decision trees?
https://datascience.stackexchange.com/questions/62151/how-often-do-we-use-m-ary-decision-trees
<p>If I come across decision trees, it is a binary tree with predicates internal nodes. How often do we use m-ary decision trees? Is there any combination of m-ary and binary decision tree, e.g. first level of the tree is binary and second level of the tree consists of m-ary? Same question arises for Random Forest.</p>...
327
decision trees
Do I need to transform time with sin/cos if I&#39;m using decision tree algorithms?
https://datascience.stackexchange.com/questions/72965/do-i-need-to-transform-time-with-sin-cos-if-im-using-decision-tree-algorithms
<p>According to this post, the time on a 24-hour clock should be decomposed into separate periodic components:</p> <p><a href="https://ianlondon.github.io/blog/encoding-cyclical-features-24hour-time/" rel="nofollow noreferrer">https://ianlondon.github.io/blog/encoding-cyclical-features-24hour-time/</a></p> <p>before ...
328
decision trees
Does running a Decision Tree classifier several times help?
https://datascience.stackexchange.com/questions/37389/does-running-a-decision-tree-classifier-several-times-help
<p>To introduce, I am a novice in ML techniques. I recently had to write a <code>scikit-learn</code> based decision tree classifier to train on a real dataset. Someone suggested me that I must run mu model several thousand times and plot the accuracies on a graph. Here's the rub: I manually ran it around 20 -30 times a...
<p>The scikit-learn <a href="http://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html" rel="nofollow noreferrer">DecisionTreeClassifier</a> takes a parameter called <code>random_state</code>. If this is set to an integer, your model should produce the same results every time.</p> <p>Th...
329
decision trees
What is the hypothesis space of decision tree learning?
https://datascience.stackexchange.com/questions/73941/what-is-the-hypothesis-space-of-decision-tree-learning
<p>Could you please explain what the hypothesis space for decision tree learning look like?</p> <p>And what is the cardinality of this space?</p>
<p>As per Tom Mitchell's,</p> <p>".....For example, consider the space of hypotheses that could in principle be output by the above checkers learner. This <strong>hypothesis space consists of all evaluation functions that can be represented by some choice of values for the weights</strong> wo through w6. <strong>The l...
330
decision trees
How to implement ID3
https://datascience.stackexchange.com/questions/104516/how-to-implement-id3
<p>I'm trying to follow the suggested outline form implementing ID3</p> <pre><code># Step 1- Calculate MC (Message Conveyed) for the given dataset (let us call it file TF) in reference to the class attribute # MC(TF) = -p1*log2(p1) - p2*log2(p2) # For n classes MC(TF) = -p1log2(p1) - p2*log2(p2)-...-pn*log2(pn) # T...
<p>Ok so let's start with the basics:</p> <ul> <li>ID3 is a decision tree learning algorithm. This is supervised learning, which means that every data point (or instance) has some features <span class="math-container">$x$</span> and a label (or class) <span class="math-container">$y$</span>. The goal is to train a mode...
331
decision trees
Decision tree, how to understand or calculate the probability/confidence of prediction result
https://datascience.stackexchange.com/questions/11171/decision-tree-how-to-understand-or-calculate-the-probability-confidence-of-pred
<p>For example, a drug prediction problem using a decision tree. I trained the decision tree model and would like to predict using new data.</p> <p>For example:</p> <pre><code>patient, Attr1, Attr2, Attr3, .., Label 002 90.0 8.0 98.0 ... ? ===&gt; predict drug A </code></pre> <p>How can I calculate the c...
<p>What data mining package do you use?</p> <p>In sklearn, the <a href="http://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html#sklearn.tree.DecisionTreeClassifier.predict_proba" rel="nofollow noreferrer">DecisionTreeClassifier</a> can give you probabilities, but you have to use things...
332
decision trees
Ordinal feature in decision tree
https://datascience.stackexchange.com/questions/14025/ordinal-feature-in-decision-tree
<p>I am curious if ordinal features are treated differently from categorical features in decision tree, I am interested in both cases where target is categorical or continuous.</p> <p>If there is a difference, could you anybody point to good source with explanation and any packages (R or Python) supporting it?</p>
<p>As per my knowledge, it doesn't matter for a decision tree model whether the features are ordinal or categorical. The goal is to create a model that predicts the value of a target variable by learning simple decision rules inferred from the data features. Decision trees describe patterns by using a list of attribute...
333
decision trees
Multicollinearity in Decision Tree
https://datascience.stackexchange.com/questions/31402/multicollinearity-in-decision-tree
<p>Can anybody please explain the affect of multicollinearity on Decision Tree algorithms (Classification and regression). I have done some searching but was not able to find the right answer as some say it affects it and others say it doesn't.</p>
<p>Desicion trees make no assumptions on relationships between features. It just constructs splits on single features that improves classification, based on an impurity measure like Gini or entropy. If features A, B are heavily correlated, no /little information can be gained from splitting on B after having split on A...
334
decision trees
Is it possible to do hard-coded decision tree on some variables and random forest / something on the remaining ones?
https://datascience.stackexchange.com/questions/97748/is-it-possible-to-do-hard-coded-decision-tree-on-some-variables-and-random-fores
<p>Is it possible to do hard-coded decision tree on some variables and random forest / something on the remaining ones?</p> <p>The situation seems that for some variables it's possible to draw strong empirical assumptions, but for others their &quot;relative importance&quot; seems more random.</p> <p>So e.g.</p> <p>Res...
<p>You could use stacking ensemble learning where one of the &quot;learners&quot; is the expert written decision tree. The meta learner will then apply the relevant weight to the expert model such that accuracy is maximized.</p>
335
decision trees
Disadvantage of decision tree
https://datascience.stackexchange.com/questions/31491/disadvantage-of-decision-tree
<p>I read in a blog that the decision tree has this disadvantage:</p> <blockquote> <p>Not fit for continuous variables</p> </blockquote> <p>If this is true, then why?</p>
<p><strong>Continuos Variable in training data (X)</strong> If you look at decision trees they try to split data based on categories in case of categorical data and based on threholds in case of continuous data. Now to split on continuous data it randomly tries to create BINs and calculate the entropy/ Gain etc whateve...
336
decision trees
Decision tree ordering
https://datascience.stackexchange.com/questions/24831/decision-tree-ordering
<p>I am interested in finding out how decision trees chose the order in which they split. I understand that splitting is based in information gain. The attribute with the lowest information gain is chosen as the root node.</p> <p>If I had a data set with columns:</p> <ol> <li>credit standing</li> <li>age</li> <li>inc...
<p>Here in your Scenario you need to select the one with more <strong>Information Gain</strong> rather than the least one and the process goes on till you reach the last feature/last node.</p> <p>Go through <a href="https://web.cecs.pdx.edu/%7Emperkows/CLASS_ROBOTICS/FEBR26-2004/ROBOT-DECISION-TREE/robot-navigation-usi...
337
decision trees
Noisy Data Robustness - NN vs Decision Tree
https://datascience.stackexchange.com/questions/119907/noisy-data-robustness-nn-vs-decision-tree
<p>We are working on a physiological marker predictor using hospital patient data. We use a boosted decision tree-type algorithm, which seems to be very sensitive to the noise in the training data. Would it be fair to say the NN's are less sensitive to noisy data than decision trees?</p>
<p>It is not fair to say that Decision Trees are more sensitive to noise in the data comparing to NN.</p> <p>It really depends on your model type (DT, NN, SVM, ... etc) and <strong>the model complexity</strong>. in general, complex models have higher tendency to overfit (overfitting == sensitive to noise in the data). ...
338
decision trees
Comparing Parameter Importance Across Models
https://datascience.stackexchange.com/questions/37660/comparing-parameter-importance-across-models
<p>I have a dataset with 20 features(columns that is). I create a few models pairs with a subset of these parameters.</p> <p>For example: If I have 6 columns (named A, B, C, D, E, F) with 10k lines of data, one of model in the pair will have (A, B, C) with all 10k lines of data and the other (A, B, C) with maybe say 6...
<p>This may not be the answer you are hoping for (I can't leave a comment because my reputation is too low) but I believe feature importance in Sci-Kit Learn is derived from the average depth at which each feature appears. I don't know of any built-in functions in Sci-Kit Learn but perhaps you could scale the feature i...
339
decision trees
How to come up with the splitting point in a decision tree?
https://datascience.stackexchange.com/questions/32129/how-to-come-up-with-the-splitting-point-in-a-decision-tree
<p>I read <a href="https://www.researchgate.net/post/How_to_compute_impurity_using_Gini_Index" rel="nofollow noreferrer">https://www.researchgate.net/post/How_to_compute_impurity_using_Gini_Index</a></p> <p>I understand why choosing smallest gini index, but how do I come up with different candidate splits in the first...
340
decision trees
what do the percentages in the leaves of a decision tree represent?
https://datascience.stackexchange.com/questions/58842/what-do-the-percentages-in-the-leaves-of-a-decision-tree-represent
<p>in figure B), there are leaves (gray boxes) with 3 values, for example, the leftmost leaf has 19.3 (28/8.7%) as its values, the 3 values are (19.3, 28, and 8.7%). </p> <p>19.3 is the average value of the instances that reach that leaf 28 is the number of instances (out of the 209 total instances) what does the 8.7%...
341
decision trees
Decision table reduction
https://datascience.stackexchange.com/questions/66352/decision-table-reduction
<p>Consider the following Decision table : <a href="https://i.sstatic.net/jknFz.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jknFz.jpg" alt="enter image description here"></a></p> <p>The following is the reduction process of this table : <a href="https://i.sstatic.net/OzaxQ.jpg" rel="nofollow noref...
342
decision trees
Using Gini index, how to calculate the probability of correctly classifying a new randomly selected case to the highest probability class?
https://datascience.stackexchange.com/questions/82102/using-gini-index-how-to-calculate-the-probability-of-correctly-classifying-a-ne
<p>I have the following binary Decision Tree:</p> <p><a href="https://i.sstatic.net/YopbR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YopbR.png" alt="enter image description here" /></a></p> <p>Can you please explain how can I report this tree to a person who only understands probabilities?</p> <bloc...
<p>While you can calculate the underlying class probabilities from the Gini index (for binary classification), it'll be more straightforward to calculate it from the &quot;value&quot; line in each box. This line simply represents the number of samples that belong in each node, split by the target variable, so you can u...
343
decision trees
Getting entropy in decision trees more than 1
https://datascience.stackexchange.com/questions/107647/getting-entropy-in-decision-trees-more-than-1
<p>My decision tree entropy is coming more than 1 when I'm calculating it manually. Not sure if there's some calculation error.</p> <p>Trying it on the <a href="https://archive.ics.uci.edu/ml/datasets/iris" rel="nofollow noreferrer">Iris dataset</a>.</p> <p>If I split on sepal length at 6.5 cm, my split looks like this...
344
decision trees
Resultant entropy of the target feature example
https://datascience.stackexchange.com/questions/109821/resultant-entropy-of-the-target-feature-example
<p>I'm confused by an example I have come across on entropy.</p> <p>In a decision tree, we have after a split on some particular feature, the following subset of our training data. What is the resultant entropy of the target feature in this set?</p> <p><a href="https://i.sstatic.net/VL6iT.png" rel="nofollow noreferrer...
345
decision trees
Decision tree classification code for categorical data
https://datascience.stackexchange.com/questions/122304/decision-tree-classification-code-for-categorical-data
<p><a href="https://i.sstatic.net/76Ot9.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/76Ot9.jpg" alt="enter image description here" /></a></p> <p>how can I apply decision tree classification to get malnutrition status(target variables are wasting, stunting,overweight,underweight)</p>
<p>Answer: You need to convert your target column into numbers first. You can try the following:</p> <pre><code>df['status'] = df['status'].map({'wasting': 0, 'stunting': 1, 'overweight': 2, 'underweight': 3}) </code></pre> <p>After this you can run your Decision tree and you will get the df['status'] in number format....
346
decision trees
Why is it called *Information Gain* and not *Information Loss*?
https://datascience.stackexchange.com/questions/126120/why-is-it-called-information-gain-and-not-information-loss
<p>I came across the concept of <em>Information Gain</em> in decision trees.</p> <p><a href="https://i.sstatic.net/zAFkb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zAFkb.png" alt="IG" /></a></p> <p>Where <span class="math-container">$I(D_p)$</span> is the information of the parent node and <span cla...
<p>Surprise and randomness aren't the same thing. A signal that contains more surprising information is more informationally valuable than one that contains less surprising information, but that has nothing to do with randomness. This links to the concept of information entropy, which is what I think the cause of the...
347
decision trees
Are Decision Trees Robust to Outliers
https://datascience.stackexchange.com/questions/37394/are-decision-trees-robust-to-outliers
<p>I read that decision trees (I am using scikit-learn's classifier) are robust to outlier. Does that mean that I will not have any side-effect if I choose not to remove my outliers? </p>
<p>Yes. Because decision trees divide items by lines, so it does not difference how far is a point from lines.</p> <p><a href="https://i.sstatic.net/OBSfq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OBSfq.png" alt="enter image description here"></a></p>
348
decision trees
Proof that Gini Impurity in a Decision Tree is Monotone Decreasing?
https://datascience.stackexchange.com/questions/94004/proof-that-gini-impurity-in-a-decision-tree-is-monotone-decreasing
<p>I asked this in a reply to an answer to another of my questions; but I think this merits its own question since I couldn't find an answer, and it's a pretty interesting question on its own.</p> <p>Suppose we construct a decision tree for classification based on the Gini impurity function. Can we prove that the weig...
<p>I think I've got a proof. Any node can be identified with the vector (p_1,...,p_k) that gives the proportion of points with each classification. The Gini impurity function can then be viewed as a function from R^k to R. The weighted average of the proportions of points in S_left and S_right belonging to a certain cl...
349
boosting
difference between model-based boosting and gradient boosting
https://datascience.stackexchange.com/questions/55128/difference-between-model-based-boosting-and-gradient-boosting
<p>What exactly is the difference between model-based boosting and gradient boosting? For an intro to model-based boosting see <a href="https://cran.r-project.org/web/packages/mboost/vignettes/mboost_tutorial.pdf" rel="nofollow noreferrer">https://cran.r-project.org/web/packages/mboost/vignettes/mboost_tutorial.pdf</a>...
<p>Gradient Boosting is fitting a base learner <span class="math-container">$f_{i}(X)$</span> to the gradient of the loss function of an existing model <span class="math-container">$F_{i-1}(X)$</span> i.e. find base learner <span class="math-container">$f_i$</span> which minimises <span class="math-container">$L(-g_i, ...
350
boosting
Adaboost vs Gradient Boosting
https://datascience.stackexchange.com/questions/39193/adaboost-vs-gradient-boosting
<p>How is AdaBoost different from a Gradient Boosting algorithm since both of them use a Boosting technique?</p> <p>I could not figure out actual difference between these both algorithms from a theory point of view.</p>
<p>Both AdaBoost and Gradient Boosting build weak learners in a sequential fashion. Originally, AdaBoost was designed in such a way that at every step the sample distribution was adapted to put more weight on misclassified samples and less weight on correctly classified samples. The final prediction is a weighted avera...
351
boosting
Ensemble Techniques - Boosting
https://datascience.stackexchange.com/questions/61333/ensemble-techniques-boosting
<p>I understand boosting is a sequential learning technique and it use the prediction from previous model as a dataset for new model ,after adding weight to the misclassified data points. The point which was not clear how the weights are added for misclassified ones and diminished for the correctly classified ones. It...
<p>Actually, it depends on the boosting algorithm you used. </p> <p>In the original boosting algorithm (Schapire 1990), three classifiers are used (say <span class="math-container">$C_1$</span>, <span class="math-container">$C_2$</span> and <span class="math-container">$C_3$</span>). The training dataset is randomly d...
352
boosting
Gradient Tree Boosting
https://datascience.stackexchange.com/questions/32952/gradient-tree-boosting
<p>I have a classification problem. In gradient tree boosting I read that-<br> 1. Initially a weak learner is fitted on the entire training dataset.<br> 2. Output of each training row is obtained. In my case it will be {0,1}. 3. Now, the second classifier will train on the residual of the prediction i.e {initial predi...
<p>My layman's understanding is that binary classification is usually calculated using the <em>logit</em> transform.</p> <p>I believe then that the residuals are the difference between the response and the predicted probabilities and the default metric for this application is the Area-Under-Curve (AUC).</p>
353
boosting
Gradient Boosting RandomSearchCV or GridSearchCV
https://datascience.stackexchange.com/questions/46120/gradient-boosting-randomsearchcv-or-gridsearchcv
<p>In your algorithms, when you use Gradient Boosting, do you prefer RandomSearchCV or GridSearchCV in order to optimize your hyperparameters ?</p> <p>Thanks for sharing your experience.</p>
<p>I think it depends on the size of your multi dimensional grid. If it is small, then you can afford to be exhaustive and do a grid search. But if it is very large, and your computation time for a grid search extends too much, then definitely go to a random search. In fact, with random search one can explore larger re...
354
boosting
Example for Boosting
https://datascience.stackexchange.com/questions/106267/example-for-boosting
<p>Can someone exactly tell me how does boosting as implemented by LightGBM or XGBoost work in real case scenerio. Like I know it splits tree leaf wise instead of level wise, which will contribute to global average not just the loss of branch which will help it learn lower error rate faster than level wise tree.</p> <p...
<p>I think what you actually ask is &quot;how does boosting work&quot;. LightGBM or XGBoost are implementations of boosting algorithms.</p> <p>I like the article by Bühlmann and Hothorn. They provide a very good overview of boosting options.</p> <blockquote> <p>P. Bühlmann, T. Hothorn (2007), &quot;<a href="https://arx...
355
boosting
Can parallel computing be utilized for boosting?
https://datascience.stackexchange.com/questions/44123/can-parallel-computing-be-utilized-for-boosting
<p>Since boosting is sequential, does that mean we cannot use multi-processing or multi-threading to speed it up? If my computer has multiple CPU cores, is there anyway to utilized these extra resources in boosting?</p>
<p>You can estimate in parallel each of the weak learners. For example, searching for optimal splits in 'weak' decision trees can be streamlined by utilizing large number of cores.</p>
356
boosting
Can we use boosting algorithms like Adaboost and gradient boosting with only one classifier
https://datascience.stackexchange.com/questions/56098/can-we-use-boosting-algorithms-like-adaboost-and-gradient-boosting-with-only-one
<p>I have been working on ensemble learning and I came across this doubt that unlike other ensemble learning algorithms like voting classifier a can we only use one classifier with boosting.</p>
<p>Boosting typically only use one algorithm as it's base learner (almost exclusively decision trees). However, you could use a mixed set of algorithms as your base learners.</p> <p>Something like this:</p> <pre><code>Boosting round 0: Add decision tree Boosting round 1: Add neural network Boosting round 2: Add KNN B...
357
boosting
Gradient Boosting - Why pseudo-residuals?
https://datascience.stackexchange.com/questions/126108/gradient-boosting-why-pseudo-residuals
<p>I have some questions I don't really understand regarding the Gradient Boosting algorithm with Decision Trees:</p> <ul> <li><p>Does the initial value matter as <span class="math-container">$\hat{y}$</span> or could you pick any, f.e between 0 and 1?</p> </li> <li><p>Why do we fit the tree to the pseudo-residuals? Wh...
<ol> <li><p>The initial prediction value <span class="math-container">$\hat{y}^{(0)}$</span> does not matter for gradient boosting. Typically it is set to the mean of the target variable for regression or the log odds of the class probabilities for classification. But any reasonable constant value works fine as the sta...
358
boosting
best way to regularize gradient boosting regressor?
https://datascience.stackexchange.com/questions/63313/best-way-to-regularize-gradient-boosting-regressor
<p>i am testing gradient boosting regressor from sklearn for time series prediction on noisy data (currency markets). </p> <p><a href="https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html" rel="nofollow noreferrer">https://scikit-learn.org/stable/modules/generated/sklearn.e...
<p>The hyper parameters that you could tune in any boosting technique are:</p> <ol> <li><p>Depth of each tree: As you rightly pointed out this is very important because each tree in boosting technique learns from the errors of the previous trees. Hence underfitting the initial trees ensure that the later trees learn a...
359
boosting
Boosting with highly correlated features
https://datascience.stackexchange.com/questions/71410/boosting-with-highly-correlated-features
<p>I have a conceptual question. My understanding is, that Random Forest can be applied even when features are (highly) correlated. This is because with bagging, the influence of few highly correlated features is moderated, since each feature only occurs in <em>some</em> of the trees which are finally used to build the...
<p>Actually, your understanding of a random forest is not 100 percent correct. Variables are sampled per split, not by tree. So every tree has access to all variables.</p> <p>In general, tree based models are not too strongly affected by highly correlated features. There are no numeric stability issues as with least s...
360
boosting
Difference between bagging and boosting
https://datascience.stackexchange.com/questions/39577/difference-between-bagging-and-boosting
<p>Can anyone explain me the basic difference between bagging and boosting and which technique can be used in which scenario?</p>
<p><strong>Bagging</strong>: Also known as Bootstrap Aggregation is an ensemble method. First, we create random samples of the training data set (sub sets of training data set). Then, we build a classifier for each sample. Finally, results of these multiple classifiers are combined using average or majority voting. Bag...
361