Pass parameters along image for Image Recognition [closed] - machine-learning

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I need to label a given image with an Image Recognition solution, and then skim the results based on another parameter.
For example, I may pass the photo of the the City Hall of a certain city, and the algorithm would return me labels identifying the possible halls, for example Bologna City Hall, Modena City Hall, ecc..., and then, based on another parameter, the location, it would give me the correct label, like if the parameter is Modena select the Modena City Hall as the correct solution.
In a case where performance is very important how would you structure this?
Have a huge model trained with all the photos and then skim based on the result?
Have a different model for every city and select the correct one thanks to the parameter?
I also talked about this with my professor and he said to me to create an Image Recognition model which also takes the parameter as input so that it automatically considers only the photo of that city, but I haven't found any way to do this.
My first solution was to train a model using the Firebase AutoML API, but if this can't be done I can do a custom solution from scratch using Python or F#.

You can build a classification model using neural network algoritm using "sklearn" library.
In this case photos (witch are your input values) are some nparrays for example a 8×8 image is a numpy array with 8 columns and 8 rows.
Then for your labels you add the cities. After that just train the MLPClassifier model from sklearn.neural_network with those data.

Related

Scrape from website and save into different columns in a spreadsheet [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 11 months ago.
Improve this question
Suppose there's a website that has a list of details of some companies, for example, name, HQ area, turnover, etc. How do I scrape that data and fill it into different columns (like name, turnover) with each row having the details of a separate company?
Google Sheets allow you to import html tables or list with the IMPORTHTML(url, query, index) function.
For example, using the Wikipedia page List of largest companies by revenue as an example.
We want the data from the main table, so the first thing that we have to do, is to know what index it occupies in the page. To do this, we can use document.querySelectorAll('table') or $$('table'), as you can see from the result, the table that we want is in the position 5 of the array, so inside our google sheet we can use:
=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_largest_companies_by_revenue","table",5)
From here, you should change the query parameter to list and find what index it occupies within the page using the method described above. In any case, you could always use IMPORTXML(url, xpath_query), and knowing the XPath of the information, you could come up with a similar solution.

UISearchController filter using two strings [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have been following the tutorial for creating a UISearchController using https://www.raywenderlich.com/113772/uisearchcontroller-tutorial
Everything is set up and working perfectly. I have two categories in my dataArray: Borough and Neighborhood. I set up my searchBar to only look into the values for Neighborhood. I created buttons for the different boroughs and what i'm hoping to achieve is when the button is pressed it will show all the possible values for that borough, but I can't seem to find anything to do this
I believe what you are saying is that you want to search for a text value entered via the search bar in the Neighbourhood values and to specifically look for the Neighbourhood in a given Borough. Correct?
If that is the case, all you'd have to do is modify your search condition. If your search condition is currently something like (to borrow from the rw.com tutorial):
return row.neighbourhood.lowercaseString.containsString(searchText.lowercaseString)
Then you'd have to modify the condition to include a check for the Borough name too - and here, we'll assume the borough variable contains the Borough name that you selected via button press:
return row.neighbourhood.lowercaseString.containsString(searchText.lowercaseString) && row.borough == borough
That should return only array values which have the specified Neighbourhood name and are in the given Borough. If that is not what you wanted, then you might want to provide a bit more detail such as the structure of the data array, how the Neighbourhoods and Boroughs are linked, and perhaps even a screenshot of the UI so that we can see how you select a Borough in the UI.

Convert text in a cell into a number

I'm creating a Google Form to make digital multiple choice tests. The answers that are given will be sent to Google Sheets. The answers are multiple choice so the data that I get consists of a limited number of possible answers.
In this spreadsheet I want to add points (like 3,3 or 5 or 10 or 0) to the answers that are given depending on whether the answer is correct (or partially correct).
In the example spreadsheet every row consists of all the answers that are given by the student. This is automatically imported like this when a student sends in the form (in this testfile I have only one question). In B30:B33 I have put the four answers the multiple choice test has for this one question and in an adjacent column the number of points each answer is worth. I want to connect the points to the answer that is given in D2 (which is a wrong answer and should result in 0).
How can I do this?
With enough responses your range of result scores is likely to get in the way where it is so I suggest moving it to another sheet and giving it a name, such as NamedRange1. But I would swap over the columns first (answers to the left of their scores) - and replacing the 0s to suit with 3,3 5 and 10.
Then in your form responses sheet Formulierreacties 1:
=vlookup(D2;NamedRange1;2;0)

Machine learning predict text fields based on text fields

I am working on machine learning and prediction for about a month. I have tried IBM watson with bluemix, Amazon machine learning, and predictionIO. What I want to do is to predict a text field based on other fields. My CSV file have four text fields named Question,Summary,Description,Answer and about 4500 lines/Recrods. No numerical fields are in the uploaded dataset. A typical record looks like below.
{'Question':'sys down','Summary':'does not boot after OS update','Description':'Desktop does not boot','Answer':'Switch to safemode and rollback last update'}
On IBM watson I found a question in their forums and a reply that custom corpus upload is not possible right now. Then I moved to Amazon machine learning. I followed their documentation and was able to implement prediction in a custom app using API. I tested on movielens data and everything was numerical. I successfully uploaded data and got movie recommendations with their python-boto library. When I tried uploading my CSV file The problem I had was that no text field can be selected as target. Then I added numerical values corresponds to each value in CSV.This approcah made prediction successful but the accuracy was not right. May be the CSV had to be formatted in a better way.
A record from the movielens data is pasted below. It says that userID 196 gave movieID 242 a two star rating at time (Unix timestamp) 881250949.
196 242 3 881250949
Currently I am trying predictionIO. A test on movielens database was run successfully without issues as told in the documentation using recommendation template. But still its unclear the possibilities of predicting a text field based on other text fields.
Does prediction run on numerical Fields only or a text field can be predicted based on other text fields?
No, prediction does not only run on numerical fields. It could be anything including text. My guess is that the MovieLens data uses ID instead of actual user and movie names because
this saves storage space (this dataset is there for a long time and back then storage is definitely a concern), and
there is no need to know the actual user name (privacy concern)
For your case, you might want to look at the text classification template https://docs.prediction.io/demo/textclassification/ . You will need to model how you want each record to be classified.

Is there any data-mining/text-mining/machine learning techniques to find the most appropriate Tags for a given document [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Say I have a huge set of documents represented in relational Table with columns
ID (unique identifier)
Title (255 characters)
Description (5000 characters)
Category (predefined meta-data )
Additional Notes (1000 characters )
I would like to add one or more Tags for each row in the document table. Here Tags refer to a word or a group of words that tells readers what a document is about.
Is there any data-mining/text-mining/machine learning techniques or approach that will help me to find the most appropriate Tags for a given document without human interference.
One of the simple possible approaches: for a given document calculate TF-IDF measure for every word and choose top-N words as tags (or cut candidates by some threshold).
Also in your case it's reasonable to use empirical boosting coefficients for words in the Title and Category fields.

Resources