How to display plot different SVM classifiers with tf-idf vector data text
I have such tf -idf vector data :
(0, 1942) 0.188013672451 (0, 2553) 0.525755724161 (0, 839) 0.289758460116 .. (1, 1942) 0.190824638347 (1, 839) 0.294090597981 (1, 519) 0.421986785183 ..
This vector is created using tf idf from text tweet, this data has 6 class label(multiclass).
It is possible to display plot different SVM classifiers like show in this link page https://scikit-learn.org/stable/auto_examples/svm/plot_iris.html ?
See also questions close to this topic
How to call a python(.py) script from a link on the DJango webpage?
I have just started learning python and django and I was wondering if there's a way to call a python script (Test.py) from a link on the django page. So far I have created a django project (TestDjango) and I have these files in that folder:
__init__.py settings.py urls.py views.py Test.py
This is what I have in my views.py script so far:
from django.http import HttpResponse def index(request): return HttpResponse('''<h1>Test</h1> <p> <!-- <a href = "https://www.python.org/"> Python </a> </br> --> </p> '''
and in my urls.py I am calling it this way:
from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.index, name ='index'), ]
When I run this on the server I get a simple page with title - "Test" and a clickable "Python" link which takes me to the python website. However, what I am looking for is a way to add a link on that django page which would call my "Test.py" script when you click on, say "Test". I have done some visualizations in that script with some mocked up data that I'd like to see on my webpage. It might be something very simple, but, I couldn't find a way to do it. Any guidance would be appreciated.
Please let me know if I missed something or any suggestion you have for me when I post any question next time.
Drawing lines with tkinter
I'm working on a project that requires me to show a grid on an image, but my code keeps erroring saying 'numpy.ndarray' object has no attribute 'load'. The error is happening at the line
draw = ImageDraw.Draw(cv_img). Why is this happening? `
import Tkinter import cv2 from PIL import Image, ImageTk, ImageDraw # Creates window window = Tkinter.Tk() # Load an image using OpenCV cv_img = cv2.imread("P:\OneSky\United States.png", cv2.COLOR_BGR2RGB) window.title("United States Map") # Get the image dimensions (OpenCV stores image data as NumPy ndarray) height, width, no_channels = cv_img.shape # Create a canvas that can fit the above image canvas = Tkinter.Canvas(window, width = width, height = height) canvas.pack() # Use PIL (Pillow) to convert the NumPy ndarray to a PhotoImage photo = ImageTk.PhotoImage(image = Image.fromarray(cv_img)) # Add a PhotoImage to the Canvas canvas.create_image(0, 0, image=photo, anchor=Tkinter.NW) # Draws lines on map draw = ImageDraw.Draw(cv_img) x = cv_img.width/2 y_start = 0 y_end = cv_img.height line = ((x,y_start), (x, y_end)) draw.line(line, fill=128) del draw # Run the window loop window.mainloop()`
Finding distances between UK postcodes
I am doing a project and am having trouble, I would like to know if there is a way to find the distance between two postcodes in python, to the nearest mile. I have searched for ages and haven't stumbled across a solution I would like it if either someone could point me in the right direction.
I would like it so that when I put two postcodes into python it will output how far they are in miles from each other. I have tried to implement a map to show the distances in tkinter but this proved to me massively difficult so I have had to refrain from doing this and had to just make it show the distance
Extracting part of string based on two conditions
I have a character column in my data set from which I want to extract part of a string based on two conditions:
a) if the string starts with "Therapist:", split the string to two columns: one column with the word "Therapist" and the other column with the remaining text.
b) if it is a "Patient:", split the string to two columns: one column with the word "Patient" and the other column with the remaining text.
The problem that I have been having is that I don't know how to create if statements in R. I'm a newbie but very willing to learn. Even after googling (stackoverflow, etc.) and trying different functions, I'm still at a loss.
Example of the data I have:
 "Therapist: Okay, we’re back…"
 "Patient: Hmm-hmm."
 "Therapist: … after a couple of hours…"
 "Patient: Hmm-hmm."
 "Therapist: Hmm… Catch me up on what you’ve found yourself thinking and feeling after the session."
I really appreciate it.
Can blockchain miners run an algorithm instead of solving a cryptographic problem?
As miners add Block to the Blockchain after solving a cryptographic hash problem. Can it be possible that instead of solving a problem like proof of work, a miner runs some algorithm on it, and if more than 51% miners give the same output then the result of the algorithm is same?
I dont know if what im asking is a thing, but i havent managed to find something usefull. I want to make a token that distributes it self everytime someone makes a transaction of trx in a certain address.
- We have 1 account with all the blablaCoin we created and 1 account that accepts trx.
- When someone sends trx in our wallet we should send them some blablaCoin in order to fake the act of mining.
- The amound of blablacoin should be the trxAmmound * a variable(the more blablacoins created the most hard to mine new coins)
How would you do that?