Skip to content

Instantly share code, notes, and snippets.

@fcharras
fcharras / gist:4e01c09acb47845622391990ce61ff24
Created November 28, 2019 11:13
Bug-causing input to QuantileTransformer
6.354323008901774372e-01,7.721565844991642447e-01
9.988797155850336340e-01,-4.732138832243185100e-02
-8.296770135526191359e-01,5.582437220268644529e-01
6.870527672236669270e-01,7.266075247685656047e-01
-3.041148323275185694e-01,9.526353808033822812e-01
-2.877167672261670139e-01,-9.577155432887802800e-01
-9.805753940631429799e-01,1.961425414281967594e-01
9.326545075388225081e-01,-3.607707992167831224e-01
8.717063187093219145e-01,-4.900286664290592342e-01
7.221165966101161793e-01,6.917713646142219508e-01
import math
import numpy as np
import torch
def kneighbors(
# NB: best performance might depend on the layout for `X` and `centroids`
# TODO: benchmark and warns or error out if the layout is not adapted
query, # (n_queries, n_features)
@fcharras
fcharras / kmeans_lloyd.py
Last active June 20, 2023 13:55
k-means lloyd implementation with pytorch (not fused)
import torch
import math
import numpy as np
def kmeans_single(
# NB: best performance might depend on the layout for `X` and `centroids`
# TODO: benchmark and warns or error out if the layout is not adapted
X, # (n_samples, n_features)
sample_weight, # (n_samples,)
SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: libpi_opencl.so [ PluginVersion: 12.27.1 ]
---> piPlatformsGet(
<unknown> : 0
<nullptr>
<unknown> : 0x7fff562f834c
) ---> pi_result : PI_SUCCESS
---> piPlatformsGet(
<unknown> : 3
<unknown> : 0x55ec664cee70