Posts by Júlio Cesar Pereira Rocha • 161 points
16 posts
-
0
votes2
answers66
viewsA: What is the basic format of a convolutional network in Keras?
Ways to avoid overfitting. 1 - At the time of separating your data separate them into 3 parts. Train,val and test. the test data will be for testing. val data is used to see network performance…
-
0
votes1
answer747
viewsA: How to save to a specific directory (python)?
Just use the OS module is very easy: notice that you currently save like this: elif k == ord('s'): cv2.imwrite(file1,img1) emLoop= False we can add the following procedure: elif k == ord('s'): if…
-
0
votes2
answers905
viewsA: check symmetrical matrix
Come on. A matrix is symmetric when it equals its transposed. and for that to be true it necessarily has to be square. in other words Aij == Aji for any element of this matrix. The code below…
-
2
votes1
answer1593
viewsA: Convert column to string where have pandas null values
you can use a lambda function: f = lambda x: '' if type(x) == np.nan else str(x) Dae just apply the column df['COL1'] = ['COL1'].apply(f) if it doesn’t work. You can turn it into a string first and…
-
1
votes3
answers233
viewsA: Error using append after merging two lists into one
The problem is that if you use: lista3 = lista3.append(nome) you are actually receiving a Nonetype object in the list3 variable. This is because the . append() method is used to increment the list3.…
-
0
votes3
answers871
viewsA: Use more than one language in the same project?
In a pragmatic way. Use Python for data extraction, (BS, scrapy. requestes.) then store the data in a database and then just access the data with another language. The interesting thing about this…
-
0
votes4
answers2357
viewsA: Python - Higher value of a dictionary per key
If I understand correctly. you have a dictionary of the type below: empr = {2:[201,200,305,2], 3:[305,405,105] } So one way to solve this is this: selec = {} for key in empr.keys(): # não precisa do…
python-3.xanswered Júlio Cesar Pereira Rocha 161 -
1
votes1
answer70
viewsA: Valueerror in Kfold from Scikit-Earn: My dataset has two classes! What’s going on?
This can happen due to the fact that one of the k-Folder folders took samples from only one class. Take a look at the size of your dataset and the size of the folders. a look if it is possible for a…
-
0
votes1
answer1375
viewsA: Scalar product
Oops. This is a very common mistake. Actually the error is not of programming but in mathematics. When we multiply two vectors we have to transpose the second. so just replace(add.): print("Escalar…
-
1
votes2
answers1557
viewsA: Making a date set Random with pandas
So. Suppose you want to select two random left onto a 4-line data_frame. you can proceed as follows: import numpy as np import pandas as pd df = pd.DataFrame({'a':[1,2,3,4],'b':[1,2,3,4]}) df_index…
-
1
votes1
answer315
viewsA: How to enter new data for prediction (text)?
The problem occurs in the following part of the code: result = loaded_model_joblib.predict(X_test) just modify to: result = loaded_model_joblib.Predict(X_test.reshape(-1,1)) or if the error…
-
0
votes2
answers106
viewsA: How to separate similar images (Pyhton / Machine learning)
First I would advise you to reduce the dimensions of these images. Because if applying a K-Means can happen the Course Of dimensionality problem that makes algorithms that use distances between one…
-
0
votes3
answers5205
viewsA: Python - Select 2 columns from a DF and sort them
If you just want to exchange the values of these columns for children, young people and adults you can use the method . apply in each column: first you create a function: def classifica_idade(x): if…
python-3.xanswered Júlio Cesar Pereira Rocha 161 -
0
votes1
answer894
viewsA: Python Unicodedecodeerro in jupyter notebook. Working with . csv
Rafael you can open the document as follows: open('arquivos/sb2.csv',encoding='utf-8','r') If you keep giving this error look at the encoding of your document. Another very interesting way to work…
-
2
votes1
answer590
viewsA: Code evaluation: Logistic regression with K fold validation. Is that correct?
Your code is correct. However a bit messy. by what you explained in the question statement is not necessary the first part above the k-fold. Another advice is to import all libs at the beginning of…
-
2
votes1
answer611
viewsA: Attributeerror: 'tuple' Object has no attribute 'reshape'
It is because . reshape is a method only of the Numpy array. So for some reason you stored the predictions of the algorithm within a tuple instead of a numpy array. you can do the following…
pythonanswered Júlio Cesar Pereira Rocha 161