I need minimum euclidean distance algorithm in python to use for a data set which has 72 examples and 5128 features. I searched a lot but wasnt successful. and just found in matlab
You could either check stackoverflow:
https://stackoverflow.com/questions/1871536/minimum-euclidean-distance-between-points-in-two-different-numpy-arrays-not-wit/1871630#1871630
Or the scipy package of python,
https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.euclidean_distances.html
On the documentation you have some extensive examples on different cases:
https://docs.scipy.org/doc/scipy/reference/spatial.distance.html
I hope some of them help you!
In addition to the answare above I give you a small example using scipy in python:
import scipy.spatial.distance
import numpy
data = numpy.random.random((72,5128))
dists = scipy.spatial.distance.pdist(data)
print("count dists = %d min dist = %d" % (len(dists), min(dists)))
output:
count dists = 2556 min dist = 28
count dists was written to check: 72*71/2 = 2556
for i in range len(x):
distance =+ sqrt(pow(x[i]-y[i]),2)
from scipy.spatial import distance
a = (1, 2, 3)
b = (4, 5, 6)
dst = distance.euclidean(a, b)
Import numpy as np
dist = np.linalg.norm(A-B)
d.append(dist)
Min = min(d)
id = d.index(Min) # the index of the minimum distance
Dear sister, you can get your target from matlab function.
Best wishes
By googling the expression "minimum euclidean distance in python" and exchanging the keywords, you would reach your target.
1. https://stackoverflow.com/questions/1871536/minimum-euclidean-distance-between-points-in-two-different-numpy-arrays-not-wit
2. https://stackoverflow.com/questions/1401712/how-can-the-euclidean-distance-be-calculated-with-numpy
Mansureh Shahraki Moghaddam Hamed Dinari Oriol Sans Planell Tibor Tajti Thank you so much. so usefull!
Salams,you use matlab function after convert it to python.
As pre-requirement to install Cassandra on windows 10, datastax is necessary or python? if python is much more important, is it necessary to have python 2.7? I have' installed python 3.6 (spyder...
06 July 2019 6,849 5 View
I need hierarchical clustering algorithm with single linkage method. whatever I search is the code with using Scikit-Learn. but I dont want that! I want the code with every details of this algorithm.
06 July 2019 561 3 View
Leukemia1 is the dataset of bone marrow and blood samples for leukemia patients at Vanderbilt University . I know that it contains 72 examples and about 5128 features and 3 classes. I searched a...
04 May 2019 7,994 3 View
I'm currently exploring the application of Python in textile engineering, specifically in areas like data analysis, process automation, and the development of smart textiles. I'm interested in...
10 August 2024 7,429 2 View
Request Python code from this article : Gender equity of authorship in pulmonary medicine over the past decade. THANKS!
08 August 2024 6,242 2 View
Visual Studio Code (VS Code) has become a popular choice among developers for several reasons: 1. **Free and Open Source**: VS Code is free to use and open source, making it accessible to...
07 August 2024 7,013 4 View
I need the python code to forecast what crop production will be in the next decade considering climate and crop production variables as seen in the attached.csv file.
05 August 2024 2,977 3 View
Hello everyone, I am currently working on a research project that aims to integrate machine learning techniques into an open source SIEM tool to automate the creation of security use cases from...
04 August 2024 3,196 2 View
Hi I am working on data driven model of the microgrid, for that, i need the reliable datasets for the identification of MG data driven Model. Thanks
02 August 2024 5,748 4 View
I am new to Micromechanics and having similar problem with understanding the implementation of the formula's. I would appreciate if anyone can guide me on how to go about getting a scalar value...
30 July 2024 969 0 View
Please, what is the memory consumption of the Matlab function quad tree decomposition procedure [S = qtdecomp(I)] with respect to the input set I?
27 July 2024 5,455 2 View
I have a dataset consisting of json files. i tried to upload a zip or tar of it but the system tells me that the file format is not accepted... br
25 July 2024 1,316 3 View
Hello, I am a research scholar currently working on a project involving image segmentation, and I am interested in using differential evolution for this purpose . I would greatly appreciate it if...
25 July 2024 9,926 1 View