Why does kde in distplot look like a sin wave? - histogram

I created a histogram in seaborn using distplot. My data is type int64, but the kde in the histogram is wavy. How can I fix it?

Related

Can I visualize the output values of my linear regression model, If I have got 3 predictor variables and 1 target variable?

I am trying to understand whether I can Visualize a 4-dimensional graph by breaking it down into smaller dimensions.
For example when we have a 2-d plane as a prediction for a 3-d graph, We can just chose a 2-d graph that shows our prediction as a line. Can I do the same for a 4-d graph? If yes then how?
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from sklearn import linear_model
data = pd.read_csv('housing.csv')
data = data[:50] #taking just 50 rows from the excel file
model = linear_model.LinearRegression() #loading the model from the library
model.fit(data[['median_income','total_rooms','households']],data.median_house_value)
# Pls add code here for visualizations
Actually you can do one funny thing - since your object is a function from R^3->R, you could, in principle, take your input space as a 3d cube (I am guessing your data is somewhat bounded), and then use colour to code your prediction. This way you will get a 3d coloured point cloud. You will probably need transparency to see through it + some interactive investigation to rotate/move around, but 4d is the highest "visualisable" dimension (as long as one dimension is "special" and thus can be coded as a colour).

Fastest way to compute cosine similarity in a GPU

So I have a huge tfidf matrix with more than a million records, I would like to find the cosine similarity of this matrix with itself. I am using colab to run the code, but I am not sure how to best make use of the gpu provided by colab.
sequentially run code -
tfidf_matrix = tf.fit_transform(df['categories'])
cosine_similarities = linear_kernel(matrix, matrix)
Is there way we can parallelise the code using jit or any other way?
try simple torch code like in this example from sentence transformers library: https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/util.py#L31
or just import the function.
consider cuml library which uses CUDA acceleration
https://docs.rapids.ai/api/cuml/nightly/api.html

How to create a convex hull of all binary spots in ImageJ

I have a binary image of separated spots.
Is there any ImageJ plugin that could construct convex hull of all spots?
Or could you recommend another program, not ImageJ, that can do this?
With OpenCV you can use findContours() and then convexHull()
You can see a complete example here: https://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/hull/hull.html
OpenCV is a library, which means that you have to code the program yourself. It has bindings for Java, python and many other languages. You can easily find the same example in other languages:
Convex Hull on Java Android Opencv 2.3
Provided you have an 8-bit (binary) image in ImageJ, you can run the following Groovy script from the script editor to get the convex hull as current selection:
## ImagePlus imp
import ij.gui.PolygonRoi
import ij.gui.Roi
import ij.plugin.filter.ThresholdToSelection
import ij.process.ImageProcessor
imp.getProcessor().setThreshold(128,255,ImageProcessor.NO_LUT_UPDATE)
roi = ThresholdToSelection.run(imp)
proi = new PolygonRoi(roi.getContainedFloatPoints(), Roi.POLYGON)
chRoi = new PolygonRoi(proi.getConvexHull(), Roi.POLYGON)
imp.setRoi(chRoi)
Note that in general, this type of question might be considered off-topic here and is better asked on the ImageJ forum, where you'll get advice from image processing experts.
Edit-Selection-make selection, then ConvexHull

Trying to convert a Float64 into Float32 on ROS

i'm working on a project on ROS, i'm trying to pass from a visualization of a marker into a visualization of a point in a pointcloud.
the markers coordinates are rappresented in float64
the points (of pcl) coordinates are rappresented in float32
i use a simil c++ for implementing code.
i want simply to try if i'm going to lose a lot of precision in terms of performance with this type of conversion.
but don't know how to do it.
did someone could help me with a piece of code that make this conversion?
thanks!

OpenCV Multilevel B-Spline Approximation

Hi (sorry for my english) .. i'm working in a project for University in this project i need to use the MBA (Multilevel B-Spline Approximation) algorithm to get some points (control points) of a image to use in other operations.
I'm reading a lot of papers about this algorithm, and i think i understand, but i can't writing.
The idea is: Read a image, process a image (OpenCV), then get control points of the image, use this points.
So the problem here is:
The algorithm use a set of points {(x,y,z)} , this set of points are approximated with a surface generated with the control points obtained from MBA. the set of points {(x,y,z)} represents de data we need to approximate (the image)..
So, the image is in a cv::Mat format , how can transform this format to an ordinary array to simply access to the data an manipulate...
Here are one paper with an explanation of the method:
(Paper) REGULARIZED MULTILEVEL B-SPLINE REGISTRATION
(Paper)Scattered Data Interpolation with Multilevel B-splines
(Matlab)MBA
If someone can help, maybe a guideline, idea or anything will be appreciate ..
Thanks in advance.
EDIT: Finally i wrote the algorithm in C++ using armadillo and OpenCV ...
Well i'm using armadillo a C++ linear algebra library to works with matrix for the algorithm

Resources