# Tag Info

Accepted

### Remove noise from data

You could try BilateralFilter: ...
• 36.1k
Accepted

### Performance of Select

res1 = Select[coordinates, #[[1]] > 6 && #[[1]] < 7 &]; // AbsoluteTiming // First 6.997629 ...
• 396k
Accepted

### Deleting duplicates after n-occurrences

I think you'll find this faster: dd[list_, n_] := Module[{pi = Flatten[Values[PositionIndex[list][[All, ;; UpTo@n]]]]}, list[[Sort@pi]]]; Using ...
• 25.8k

### Deleting sublists from lists

ReplaceRepeated is fine for short lists but it will get very slow if the list is long, because it starts over from the beginning of the list after each replacement. ...
• 272k

### Performance of Select

Slightly faster than @kglr's solution is to use Clip: ...
• 131k
Accepted

### How to construct a list of lengths efficiently

You can use the usual UnitStep + Total tricks: ...
• 131k
Accepted

### Finding outliers in 2D and 3D numerical data

The question title poses a good question, although the question formulation is somewhat specialized and misplaced (as mentioned in a comment). This answer provides data and a method description ...
• 37.9k

### Find duplicates in list of InfiniteLine

DeleteDuplicates[lines, RegionWithin] {InfiniteLine[{{0, 0}, {1, 0}}], InfiniteLine[{{0, 1}, {1, 0}}]} Also ...
• 396k
Accepted

### Deleting sublists from lists

Try testList //. {a___, aa_Symbol, _Integer, bb_Symbol, b___} :> {a, aa, bb, b} {a, b, c, 4, 5, d, e, f, g, 4} ...
• 3,473
Accepted

### Removing outliers from data

You could take a look at the built-in functions FindAnomalies and DeleteAnomalies. We can use ...
• 13.1k

### Remove noise from data

I would suggest using a median filter with small radius to eliminate the large spikes, then a mean filter to smooth the remaining signal. @Xavier essentially combines these two filters by using ...
• 15.3k

### Deleting sublists from lists

Mr.Wizard inspired me to improve. While his recursive approach is elegant, the problem clearly can be done linearly. Indeed: ...
• 3,473
Accepted

...
• 24k
Accepted

...
• 396k

### How can I code a "smart" version of Chop?

We can turn to unsupervised machine learning in the form of clustering algorithms to try to automate this intuition. Here are a few different results using ...
• 70.7k

### Finding the two pairs in a list of pairs that minimize and maximize a given function

list = {{1, 2}, {5, 3}, {9, 2}} func = 2*#[[1]] + #[[2]] &; Through[{MinimalBy[func], MaximalBy[func]}[list]] ...
• 27.5k

### Deleting sublists from lists

The slowest part of @MrWizard's solution is the conversion to 1s and 0s. Here is a faster way to do this conversion: ...
• 131k
Accepted

### Ordered RandomSample

Avoiding Sort makes it a bit faster ...
• 20.3k
Accepted

### Most efficient numerical selectBetween

Varying samples (Updated to include internal function) For varying samples, I think the best non-compiled method is to use Pick as you did. You can speed up the ...
• 131k
Accepted

### Given a list of integers, find the largest sum of a contiguous subsequence

f[l_] := Module[{sl = Flatten@MaximalBy[Subsequences[l], Total]}, {Total[sl], sl}] f[{1, 2, 3, 4, 5, -1, 7, -4, -2}] (* {21, {1, 2, 3, 4, 5, -1, 7}} *)
• 61.6k
Accepted

### List letters at even- or odd-numbered positions in Alphabet

Much simpler solution: Alphabet[][[1 ;; All ;; 2]] Alphabet[][[2 ;; All ;; 2]]
• 23.6k
Accepted

### Writing Faster Mathematica Code - Sow and Reap?

Here's a million points processed in half a second: ...
• 237k

### Solving chess bishop problem

Mathematica's FindIndependentVertexSet can find maximal independent set (size 14 =2n-2) by default. The following finds "12". I have not explored symmetries as I am ...
• 61.6k

### Deleting sublists from lists

f0 = Flatten @ DeleteCases[{_Integer}] @ SplitBy[#, IntegerQ] &; f0 @ testList {a, b, c, 4, 5, d, e, f, g} Timings between those of Mr.Wizard's ...
• 396k

### How to construct a list of lengths efficiently

BinCounts and Accumulate combination is faster than all the methods posted so far: ...
• 396k
Accepted

### Using Select on Dataset with missing keys

You can use the Slot function rather than #slot. This is nearly as fast as the #slot implementation, but doesn't cause this issue. ...
• 13.1k

### DeleteCases for once only

You can Fold the four-argument form of DeleteCases: ...
• 396k
Accepted

### How can I speed up processing with DeleteCases?

As kglr says, you should use RegionMember. However, instead of mapping RegionMember (which is basically what his ...
• 131k
Accepted

### Association vs Pair - Creation performance, Selection performance

Simply use keys = Range[1000000]; vals = Range[1000000]^2; result = Pick[vals, PrimeQ[keys]]; to get the best of both worlds (zero construction cost and even ...