|
|
|
|
|
|
|
Programming › Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by JFOD: 1:11pm On Aug 03, 2021 |
EWSTechSupport: I will be sharing some useful repos for laravel developers here soon. Watch out! Alright |
|
|
|
|
Programming › DS / ML Engineer Needed by JFOD(op): 1:45am On Jul 15, 2021 |
Hi
can you explain the implementation (from scratch) and theory of some of the classification algorithms (Especially Naive Bayes ).
Preferably, using Python (other languages can work too). I've read some articles and watched some videos ,they are not helping (getting more and more confused).
Thank you in advance |
|
|
|
Programming › Re: Thread For Nairaland Algorithm Questions by JFOD: 11:37pm On Jul 04, 2021 |
How can one generate a sub list of a list efficiently. List = [1, 2,3] sub_list = [ [1], [1,2] , [2] , [2,3], [3] , [1,2,3]] My solution for i in range(len(lst) + 1): for j in range(i): sub = lst[j: i]
Is there a more efficient method to do this? |
Programming › Re: Thread For Nairaland Algorithm Questions by JFOD: 2:16pm On Jul 04, 2021 |
Deicide: did you test this code? am getting error for unique_num = {lst} unhashable type. though the solutions is correct. but then answer wouldn't be unique cause I have to remove {} I did not test the code. how to fix it #this will convert the list to set (set doesn't #allow duplicate values, so it will only have #unique numbers) unique_num = set(lst) |
|
Programming › Re: Thread For Nairaland Algorithm Questions by JFOD: 1:18am On Jul 04, 2021 |
Deicide: You are given an array and asked to find the element in the array that appears k times.
eg
arr = {1, 2, 2, 3, 3,3,4,4,4,4}
fun = foo(arr, k) k = 2
ans = 2 I'll make use of python (it's easy to get the unique numbers using set) I'm assuming, list will be passed def findK(lst, x): unique_num = {lst} num_with_x_occurence = [ ]
for i in unique_num: occurrence = lst.count(i)
if occurrence == x: num_with_x_occurence.append(i)
return num_with_x_occurence
|
Programming › Re: Thread For Nairaland Algorithm Questions by JFOD: 12:26am On Jul 04, 2021 |
Deicide: You are given an array and asked to find the element in the array that appears k times.
eg
arr = {1, 2, 2, 3, 3,3,4,4,4,4}
fun = foo(arr, k) k = 2
ans = 2 Hmm, if I'm to solve this First attempt: Get the unique numbers loop through it get the count of each number Append it to a list /print it out if the count = 2 |
Programming › Re: Thread For Nairaland Algorithm Questions by JFOD: 9:03pm On Jul 03, 2021 |
Brukx: Exercise Write a pagination function. This function will convert a 1 dimensional array into a paginated 2 dimensional array. It will take 2 arguments. The first argument is the array to be paginated and the second one is the number of elements per pagination.
Examples list=[1,2,3,4,5,6,7,8,9,10]
paginate(list, 5) should return [[1,2,3,4,5], [6,7,8,9,10]]
paginate(list,2) should return [[1,2], [3,4], [5,6], [7,8], [9,10]]
paginate(list, 3) should return [[1,2,3], [4,5,6], [7,8,9], [10]]
def page(lst, move): length = len(lst) output = [ ] for i in range(0, length,move): if i+ move < length: output.append(lst[i: i+move]) else: output.append(lst[i:])
return output print(page(list,5))
|
|
|
|
|
|
|
|
Programming › Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by JFOD: 4:55pm On Jun 16, 2021 |
Well ,I just started learning laravel. To keep the thread alive what do you think about posting small task, tips etc. I am currently working on a project (don't have na end goal, just adding features one by one). So far , I've added File upload (image , during registration) Login/Registration + Auth + Validation Delete button (yet to fully implement this , another user can delete someone else's profile  ). I don't think that should be hard to fix I'll probably just make the delete button to only show when the owner is viewing the profile. I've paused it due to some other engagement and electricity issues. I was trying to implement the chat feature. Now, the issue I had How to display the chat of the message that was clicked. One can't do that with php/laravel (I stand to be corrected) I used JavaScript to detect which message was clicked. The problem I had/have is how to send the id of the message to the backend , so that I can retrieve the messages with the same sender and receiver id. I'm just few weeks old in laravel  |
|
|