Note: We are using '?' as there are only 2 values of the attributes. In case there would be more than 2 values of the attribute e.g. (Cool,Warm & Hot) and we got just 2 of these (Cool & Warm) so we'll not use '?' but instead of that we'll just use these 2 by using OR sign.
hi... I have a numerical data set like two examples say (7,4) and (5,8) classified as +VE and two examples say(1,3) and (3,2) classify as -VE.... how candidate elimination algo ll work on this..
Thanks a lot bro. Very clear explanation. Edit: This video/dataset doesn't cover 1 case, Where we encounter negative row witch has attributes matching the specific hypothesis, then those attribute groups are needed to be removed from the general hypothesis. For example - At the end of this dataset, our general hypothesis is - ['Sunny', '?', '?', '?', '?', '?'], ['?', 'Warm', '?', '?', '?', '?'] Specific hypothesis - ['Sunny' 'Warm' '?' 'Strong' '?' '?'] Include [Rainy,Warm,High,Strong,Warm,Change,No] at the end of the dataset. Then, as the 2nd attribute 'Warm' matches with the specific hypothesis, we need to remove the 2nd element from the general hypothesis and the it becomes - ['Sunny', '?', '?', '?', '?', '?']. Hope this helps someone!
the version space diagram lies in between the specific and the generic.. if you notice in the specific hypo.S4 there are 3 values, thus the permutation will be 6.. ie the various combinations of those values together will give the version space.. please correct me if I am wrong, even I'm not entirely sure about this.
@@nishads7606 version space with respect to hypothesis space H and training example D, is the subset of hypothesis from H, which are consistent with the training example D. So if h is subset of H, Then Versions pace = { h∈H | consistent (h,D) } PS: consistent means the hypothesis which produces the best fit on training examples. Yours truly, Praveen
7:40 G4 is and you wrote but its only have sunny, where strong and warmn comes in, in right side u wrote warm only once but u said this 2 came from. I didnt get theese table. but thank you.
That version diagram is arrived from considering various possible hypothesis, it could be explained by taking only 2 or 3 attributes, but with so many it will take a large amount of possible hypothesis.
@@CodeWrestling hello sir in version space you have made only three sets can we make more?for example can we make sets of sunny with combination of other attributes?please help me out.thanks
@@shireeniqbal7399 you can make more such combinations(if there are), but with this particular example though, you won't be able to generate more than those 3 mentioned combinations.
I hope you understood how we got S4, now look at G3, at its 3rd index, it says that feature forecast should have value 'same'. But in S4, we got a hypothesis that says that feature forecast can have any value '?'. Thus, for G4 we will remove that specification to compulsory have that feature forecast value as 'same'. I hope you understood. If still not, then please comment down. We are happy to help !!
Okay. Sorry we didn't cover that part. Please go through this document, page no. 12. www.ccs.neu.edu/home/rjw/csg220/lectures/version-spaces.pdf Here, they have taken only two attributes and explained. For the example in video, we have to make a 5D structure that can explain, how did we get that version space. If you still didn't understand, then we will create another video on it to explain.
There are three values in the most specific hyp, and 1 value each in most generalised hpy, hence we now consider two values as intermediary, and hence take all the permutations possible of the three attributes in the most specific hpy
mere ko samaj aaa gaya but aap bohot portion explain kiye bina chodke aage bud rahe ho. PLEASE try to explain all portion in ur explanation. For example question mark ka position generalization me nahi bata rahe ho. Still Clear hogaya. THANKS!!!
import numpy as np import csv def candidateElimination(): data = [] csvFile = open('Data2.csv', 'r') reader = csv.reader(csvFile, delimiter = ',') for row in reader: data.append(np.array(row)) # Convert To Numpy Array data = np.asarray(data, dtype = 'object') X = data[:, :-1] Y = data[:, -1].reshape(X.shape[0], 1) print (" Training Data :") print (X) print (" Labels :") print (Y) print(" Shape Of X :") print (X.shape) print (" Shape Of Y :") print (Y.shape) specificH = [" % " for _ in range(X.shape[1])] specificH = np.asarray(specificH, dtype = 'object') generalH = [[" ? " for _ in range(X.shape[1])] for _ in range(X.shape[1])] generalH = np.asarray(generalH, dtype = 'object') print (" Initial Hypothesis :") print (specificH) print (" Initial General Hypothesis :") print (generalH) # Set First Positive Example To Hypothesis if Y[0] == "P": specificH = X[0] else: for i in range(Y.shape[0]): if Y[i] == "P": specificH = X[i] break
print (" Candidate Elimination : ") # For Each Training Example for i in range(X.shape[0]): # Positive Example if Y[i] == "P": for j in range(X.shape[1]): if X[i][j] != specificH[j]: specificH[j] = '?' if specificH[j] != generalH[j][j] and generalH[j][j] != "?": generalH[j][j] = "?" print (" ---------Step " + str(i + 1) + "--------- ") print (" Specific Set : ") print (specificH) print (" General Set : ") print (generalH) print (" ------------------------ ") # Negative Example else: for j in range(X.shape[1]): if X[i][j] != specificH[j]: generalH[j][j] = specificH[j] print (" ---------Step " + str(i + 1) + "--------- ") print (" Specific Set : ") print (specificH) print (" General Set : ") print (generalH) print (" ------------------------ ") print (" Final Specific Hypothesis : ") print (specificH) print (" Final General Hypothesis : ") print (generalH) print (" ") candidateElimination()
import numpy as np import pandas as pd data = pd.DataFrame(data=pd.read_csv('data2.csv')) concepts = np.array(data.iloc[:,0:-1]) print(concepts) target = np.array(data.iloc[:,-1]) print(target) def learn(concepts, target): specific_h = concepts[0].copy() general_h = [["?" for i in range(len(specific_h))] for i in range(len(specific_h))] for i, h in enumerate(concepts): if target[i] == "Yes": for x in range(len(specific_h)): if h[x] != specific_h[x]: specific_h[x] = '?' general_h[x][x] = '?' if target[i] == "No": for x in range(len(specific_h)): if h[x] != specific_h[x]: general_h[x][x] = specific_h[x] else: general_h[x][x] = '?' indices = [i for i,val in enumerate(general_h) if val == ['?', '?', '?', '?', '?', '?']] for i in indices: general_h.remove(['?', '?', '?', '?', '?', '?']) return specific_h, general_h s_final, g_final = learn(concepts, target) print("
Wow,that was crisp,Really helpful, could have taken two more minutes on version spaces....it is obvious but not until you spend sometime.
Wow well explained in short span of time, my lecture took 5 classes to explain this
Bahut accha samajaya he.
Short me aur perfect.
Aise hi bnate rho hum like share karte rahege.
i skipped 26 mins lecture to listen thiss and this helped meeee thankyou
Super 😍😍 ty so much for explaining the concept in detail and upload more videos about machine learning so that we can learn more
Thanks for the explanation, keep up the work bro
Awesome! Keep rocking
Note: We are using '?' as there are only 2 values of the attributes. In case there would be more than 2 values of the attribute e.g. (Cool,Warm & Hot) and we got just 2 of these (Cool & Warm) so we'll not use '?' but instead of that we'll just use these 2 by using OR sign.
Thanks for note #codewrestling 😊
Thnk u brooooo. ...vry easy to understand. ..
Beautifully explained..Thanks sir...
You are great :) , Nicely explained, Please make more videos on ML topics :)
thank you for such a easy explanation
Sir this was very much help full
hi... I have a numerical data set like two examples say (7,4) and (5,8) classified as +VE and two examples say(1,3) and (3,2) classify as -VE.... how candidate elimination algo ll work on this..
Awesome Explanation!
NYC explanation bro....thank you
Tqsm
I have 12 minutes left for my quiz. This video saved me! Thanks much!
Go prepare for quiz,dont waste time on comments😂
Explained it beautifully...except for the last part
Well done
Excellent , Please upload Inductive bias in concept learning
helpful, thank you
What about warm it's also changed to question mark
thank you so much 🥰
You explained better than my lecturer. Thank you so mych for the informative concept.
Glad it was helpful!
thankyou
but can you explain about the last page i.e version space
iam unable to understand the last page
OMG!! Great Videoo!!!
keep it up bro
Thanks a lot bro. Very clear explanation.
Edit: This video/dataset doesn't cover 1 case,
Where we encounter negative row witch has attributes matching the specific hypothesis, then those attribute groups are needed to be removed from the general hypothesis.
For example -
At the end of this dataset, our general hypothesis is - ['Sunny', '?', '?', '?', '?', '?'], ['?', 'Warm', '?', '?', '?', '?']
Specific hypothesis - ['Sunny' 'Warm' '?' 'Strong' '?' '?']
Include [Rainy,Warm,High,Strong,Warm,Change,No] at the end of the dataset. Then, as the 2nd attribute 'Warm' matches with the specific hypothesis, we need to remove the 2nd element from the general hypothesis and the it becomes - ['Sunny', '?', '?', '?', '?', '?'].
Hope this helps someone!
Thankssss
Sir i got a doubt,, 'warm' in specific and general hypotesis is matching and we removing it then 'sunny' also matching y we kept it remain?
Magical✨
Best video.. Awesome
simply super
thanq sir
Thanks !
How to get the version space diagram
the version space diagram lies in between the specific and the generic.. if you notice in the specific hypo.S4 there are 3 values, thus the permutation will be 6.. ie the various combinations of those values together will give the version space..
please correct me if I am wrong, even I'm not entirely sure about this.
@@nishads7606 Ayee Nishad, teach me also 😂🤣
@@nishads7606 version space with respect to hypothesis space H and training example D, is the subset of hypothesis from H, which are consistent with the training example D.
So if h is subset of H,
Then Versions pace = { h∈H | consistent (h,D) }
PS: consistent means the hypothesis which produces the best fit on training examples.
Yours truly,
Praveen
PLEASEEE UPLOADDD MOREEE VIDEOSSSS..
What will we have to do if we encounter a -ve attribute at the very beginning????
swap that , order doesnt matter
Use any other value for G1, which is not in that row
U can refer this: stackoverflow.com/questions/22625765/candidate-elimination-algorithm/22637185
You did a wonderful job bro. Nice Explanation.
Thank you so much 🙂
awesome
Thanks man
Thankyou
Crisp and clear, you made my day! :) Thanks!
Plz can u make one more example regarding find s
thank you thank you so much
Anytime!!
We also do/help in implementing project ideas. Feel free to reach us at codewrestling@gmail.com
hey,,thanks,, u teach better than NITs and IITs teachers
That's the best comment ever received. Thank you so much.
We also help in implementing project ideas. Feel free to reach us at codewrestling@gmail.com
Thank you very much
Anytime!!
We also do/help in implementing project ideas. Feel free to reach us at codewrestling@gmail.com
It was really helpful......Thanks
Glad it helped
sir please upload implementation also
💯
I not understand G4 , can u tell me
Thank you
You're welcome
7:40 G4 is and you wrote but its only have sunny, where strong and warmn comes in, in right side u wrote warm only once
but u said this 2 came from. I didnt get theese table. but thank you.
the version space is an intermediate for the specific and generalized hypothesis. So it must satisfy both s4 and g4.
@@adityashenoy9887 Thanks for your replay but I already pass the exam 😀
Hi,
Thanks for the explanation,It is really good :-)
Can you explain about version space in diagram (Time line : 7:37) ?
That version diagram is arrived from considering various possible hypothesis, it could be explained by taking only 2 or 3 attributes, but with so many it will take a large amount of possible hypothesis.
@@CodeWrestling hello sir in version space you have made only three sets can we make more?for example can we make sets of sunny with combination of other attributes?please help me out.thanks
@@shireeniqbal7399 you can make more such combinations(if there are), but with this particular example though, you won't be able to generate more than those 3 mentioned combinations.
great work dude
Glad it helped!
We also help in implementing projects. Reach us at codewrestling@gmail.com
Tbh better than all of my university lecturers combined
Thanks a lot #codewrestling
Thanks. It helped.
Nice explanation
Thanks! #codewrestling
it's awesome.can u please increase u r voice so it wil be more interactive
yeah we will try to in coming videos
I didn't get version space between S4 and G4
I hope you understood how we got S4, now look at G3, at its 3rd index, it says that feature forecast should have value 'same'. But in S4, we got a hypothesis that says that feature forecast can have any value '?'. Thus, for G4 we will remove that specification to compulsory have that feature forecast value as 'same'. I hope you understood. If still not, then please comment down. We are happy to help !!
+Code Wrestling
I understood G3 and S4 but in the last part of the video...how did u get version space between G3 and S4
Okay. Sorry we didn't cover that part. Please go through this document, page no. 12.
www.ccs.neu.edu/home/rjw/csg220/lectures/version-spaces.pdf
Here, they have taken only two attributes and explained. For the example in video, we have to make a 5D structure that can explain, how did we get that version space.
If you still didn't understand, then we will create another video on it to explain.
@@CodeWrestling yes please do
@@vibhad4959 Sure we will make it asap
great explanation bro :-)
:-)
I didn't get that how you calculated that version space..i need that part only
same doubt to me also swati
bhai bhai
wow nice explanation tnks bro we have ml exam on april1
I didn't get that version space between those two hypothesis .....
There are three values in the most specific hyp, and 1 value each in most generalised hpy, hence we now consider two values as intermediary, and hence take all the permutations possible of the three attributes in the most specific hpy
@@arunprasad8606 Thanks a lot bro even i was confused with it.
How to get Version Space ?? And the diagram 😢
same with me also john
mere ko samaj aaa gaya but aap bohot portion explain kiye bina chodke aage bud rahe ho. PLEASE try to explain all portion in ur explanation. For example question mark ka position generalization me nahi bata rahe ho. Still Clear hogaya. THANKS!!!
Can you explain for the negative instance first !
I'll tell you later. Don't worry !
@@VinitaKumari-sr8hq arey Tera channel h Kya?
Kab aau padhne ?? 😂
Plz explain for the negative instance first !
did you find how we do it ?
@LivoGraphyInDe
You have not taken the case where the General Hypothesis you are gonna make is already present
I will look into it and will get back to you soon! #codewrestling
U removed the same,,,but the warm also became ? Then y don't u remove the warm content,, general hypothesis should be only sunny?????
Na you got wrong at example 3
Can I get the python code for this?
import numpy as np
import csv
def candidateElimination():
data = []
csvFile = open('Data2.csv', 'r')
reader = csv.reader(csvFile, delimiter = ',')
for row in reader:
data.append(np.array(row))
# Convert To Numpy Array
data = np.asarray(data, dtype = 'object')
X = data[:, :-1]
Y = data[:, -1].reshape(X.shape[0], 1)
print ("
Training Data :")
print (X)
print ("
Labels :")
print (Y)
print("
Shape Of X :")
print (X.shape)
print ("
Shape Of Y :")
print (Y.shape)
specificH = [" % " for _ in range(X.shape[1])]
specificH = np.asarray(specificH, dtype = 'object')
generalH = [[" ? " for _ in range(X.shape[1])] for _ in range(X.shape[1])]
generalH = np.asarray(generalH, dtype = 'object')
print ("
Initial Hypothesis :")
print (specificH)
print ("
Initial General Hypothesis :")
print (generalH)
# Set First Positive Example To Hypothesis
if Y[0] == "P":
specificH = X[0]
else:
for i in range(Y.shape[0]):
if Y[i] == "P":
specificH = X[i]
break
print ("
Candidate Elimination : ")
# For Each Training Example
for i in range(X.shape[0]):
# Positive Example
if Y[i] == "P":
for j in range(X.shape[1]):
if X[i][j] != specificH[j]:
specificH[j] = '?'
if specificH[j] != generalH[j][j] and generalH[j][j] != "?":
generalH[j][j] = "?"
print ("
---------Step " + str(i + 1) + "---------
")
print ("
Specific Set : ")
print (specificH)
print ("
General Set : ")
print (generalH)
print ("
------------------------
")
# Negative Example
else:
for j in range(X.shape[1]):
if X[i][j] != specificH[j]:
generalH[j][j] = specificH[j]
print ("
---------Step " + str(i + 1) + "---------
")
print ("
Specific Set : ")
print (specificH)
print ("
General Set : ")
print (generalH)
print ("
------------------------
")
print ("
Final Specific Hypothesis : ")
print (specificH)
print ("
Final General Hypothesis : ")
print (generalH)
print ("
")
candidateElimination()
yeah sure and do you want the explanation for that too?
import numpy as np
import pandas as pd
data = pd.DataFrame(data=pd.read_csv('data2.csv'))
concepts = np.array(data.iloc[:,0:-1])
print(concepts)
target = np.array(data.iloc[:,-1])
print(target)
def learn(concepts, target):
specific_h = concepts[0].copy()
general_h = [["?" for i in range(len(specific_h))] for i in range(len(specific_h))]
for i, h in enumerate(concepts):
if target[i] == "Yes":
for x in range(len(specific_h)):
if h[x] != specific_h[x]:
specific_h[x] = '?'
general_h[x][x] = '?'
if target[i] == "No":
for x in range(len(specific_h)):
if h[x] != specific_h[x]:
general_h[x][x] = specific_h[x]
else:
general_h[x][x] = '?'
indices = [i for i,val in enumerate(general_h) if val == ['?', '?', '?', '?', '?', '?']]
for i in indices:
general_h.remove(['?', '?', '?', '?', '?', '?'])
return specific_h, general_h
s_final, g_final = learn(concepts, target)
print("
Final S:", s_final)
print("
Final G:", g_final)
@@CodeWrestling yes sir plz explain the code
not quite understand...
Bhai what is hypothesis ?? 😅
Not at all clear
whatsapp sounds really makes me feel swirl
kya sikhate b?
Machine Learning
Did not understand how to frame set of hypotheses from general and specific hypotheses!! So m gonna dislike for wasting my time
U removed the same,,,but the warm also became ? Then y don't u remove the warm content,, general hypothesis should be only sunny?????