classification

Tensorflow & Keras prediction threshold

烂漫一生 提交于 2020-08-09 10:51:31
问题 What is the threshold value that is used by TF by default to classify an input image as being a certain class? For example, say I have 3 classes 0 , 1 , 2 , and the labels for images are one-hot encoded like so: [1, 0, 0] , meaning this image has label of class 0. Now when a model outputs a prediction after softmax like this one: [0.39, 0.56, 0.05] does TF use 0.5 as the threshold so the class it predicts is class 1? What if all the predictions were below 0.5 like [0.33, 0.33, 0.33] what

Difference between Dense(2) and Dense(1) as the final layer of a binary classification CNN?

大城市里の小女人 提交于 2020-08-01 03:51:49
问题 In a CNN for binary classification of images, should the shape of output be (number of images, 1) or (number of images, 2)? Specifically, here are 2 kinds of last layer in a CNN: keras.layers.Dense(2, activation = 'softmax')(previousLayer) or keras.layers.Dense(1, activation = 'softmax')(previousLayer) In the first case, for every image there are 2 output values (probability of belonging to group 1 and probability of belonging to group 2). In the second case, each image has only 1 output

How to train a model that will result in the similarity score between two news titles?

自作多情 提交于 2020-07-22 21:40:04
问题 I am trying to build a Fake news classifier and I am quite new in this field. I have a column "title_1_en" which has the title for fake news and another column called "title_2_en". There are 3 target labels; "agreed", "disagreed", and "unrelated" if the title of the news in column "title_2_en" agrees, disagrees or is unrelated to that in the first column. I have tried calculating basic cosine similarity between the two titles after converting the words of the sentences into vectors. This has

How to train a model that will result in the similarity score between two news titles?

♀尐吖头ヾ 提交于 2020-07-22 21:38:38
问题 I am trying to build a Fake news classifier and I am quite new in this field. I have a column "title_1_en" which has the title for fake news and another column called "title_2_en". There are 3 target labels; "agreed", "disagreed", and "unrelated" if the title of the news in column "title_2_en" agrees, disagrees or is unrelated to that in the first column. I have tried calculating basic cosine similarity between the two titles after converting the words of the sentences into vectors. This has

How to train a model that will result in the similarity score between two news titles?

人盡茶涼 提交于 2020-07-22 21:38:20
问题 I am trying to build a Fake news classifier and I am quite new in this field. I have a column "title_1_en" which has the title for fake news and another column called "title_2_en". There are 3 target labels; "agreed", "disagreed", and "unrelated" if the title of the news in column "title_2_en" agrees, disagrees or is unrelated to that in the first column. I have tried calculating basic cosine similarity between the two titles after converting the words of the sentences into vectors. This has

How do I output confidence level in Resnet 50 classification?

纵饮孤独 提交于 2020-07-16 01:35:07
问题 I trained Resnet-50 classification network to classify my objects and I use the following code to evaluate the network. from tensorflow.keras.models import load_model import cv2 import numpy as np import os class_names = ["x", "y", "b","g", "xx", "yy", "bb","gg", "xyz","xzy","yy"] model = load_model('transfer_resnet.h5') model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy']) imgg = cv2.imread('/path to image/a1.jpg') img = cv2.resize(imgg,(224,224)) img = np

Detecting audio inside audio [Audio Recognition]

為{幸葍}努か 提交于 2020-07-10 07:26:43
问题 I need to build a software that does audio recognition from a small audio sample (A) inside other audio samples (B), and output how many times A appears inside the audio from B (if there is a match). What I have: A database with hundreds of audios Input: New audio Expected Output: A boolean if the input matches a sample from the database, and how many times appeared the input inside the matched audio (from the db). Any code, open source project, guides, books, videos, tutorial, etc... is

Detecting audio inside audio [Audio Recognition]

寵の児 提交于 2020-07-10 07:26:42
问题 I need to build a software that does audio recognition from a small audio sample (A) inside other audio samples (B), and output how many times A appears inside the audio from B (if there is a match). What I have: A database with hundreds of audios Input: New audio Expected Output: A boolean if the input matches a sample from the database, and how many times appeared the input inside the matched audio (from the db). Any code, open source project, guides, books, videos, tutorial, etc... is

How to preserve id's after data balancing technique like ROSE, SMOTE

拜拜、爱过 提交于 2020-07-09 15:00:47
问题 df1 = data.frame(id=c('A1','2','B3','4','5','6','7','8','9','10'),s1c1=c(0,0.2,0,0.5,0.8,0,0,0,0,0),s1c2=c(0,0,0.3,0,0,0.9,0.3,0,0,0),s1c3=c(0.1,0,0,0,0,0,0,0.2,0.8,0.1)) df2 = data.frame(id=c('A1','2','B3','4','5','6','7','8','9','10'),s2c1=c(0,0.22,0,0.35,0.8,0,0,0,0,0),s2c2=c(0,0,0.23,0,0,0.7,0.3,0,0,0),s2c3=c(0.2,0,0,0,0,0,0,0.4,0.9,0.4)) df <- merge(df1,df2, by="id",all=TRUE) df$class <- c(0,0,0,0,0,1,1,0,0,0) > df id s1c1 s1c2 s1c3 s2c1 s2c2 s2c3 class 10 0.0 0.0 0.1 0.00 0.00 0.4 0 2 0

Does the training set and testing set have to be different from the predicting set?

烂漫一生 提交于 2020-06-29 04:01:22
问题 I know the general rule that we should test a trained classifier only on the testing set. But now comes the question: When I have an already trained and tested classifier ready, can I apply it to the same dataset that was the base of the training and testing set? Or do I have to apply it to a new predicting set that is different from the training+testing set? And what if I predict a label column of a time series (edited later: I do not mean to create a classical time series analysis here, but