728x90

6.6 SVM이 노이즈에 대해 민감한 이유를 설명하라.

 

참고 답안:

SVM 모델의 결정 경계는 소량의 서포트벡터에만 의존한다. 만약 노이즈가 생기면 서포트벡터 자체에 영향을 미치기 때문에 최종 모형이 변할 수 있다. 

이 때문에 소프트 마진, 하드 마진 개념이 나온 것이다. 

SVM은 이상치에도 민감하지만 scale에도 민감하다.

 

 

728x90

6.5 가우스 SVM과 RBF 신경망 사이의 관계에 대해 기술하라

 

RBF신경망에서 은닉층 뉴런 개수를 훈련 데이터 수로 설정하고, 각 샘플을 뉴런 센터(c)로 설정하면, 이때 RBF의 예측 함수는 SVM의 활성화 함수와 동일하다.

 

두 모델의 차이는 큰 편이라 생각하는데,

 

- RBF활성화 함수에서 분산을 컨트롤하는 파리미터인 β는 모델에 의해 학습되지만, SVM에서는 하나의 하이퍼파리미터이다.

- 목적함수나 최적화 방식이 다르다

 

그러나 RBF에서  β를 SVM과 동일하게 고정한다면 훈련 결과는 비슷할 것이다 (추측...)

 

 

 

728x90

6.4 선형 판별분석과 선형 커널 서포트 벡터 머신이 어떤 조건에서 같은지 논의하라.

 

간단하게 설명하면, 선형 서포트 벡터 초평면 w와 LDA 투영 방향 w'가 수직일때 둘은 같다 (그림 참조).

 

 

참조:

아래는 iris데이터의 0번째 클래스와 2번째 클래스를 훈련세트로 사용하여 분류한 그림인데, 선형 분리 가능한 데이터에서는 결과값은 크게 다르지 않다는 것을 알 수 있다. 그러나 여기서 말하는 '같은 조건'은 두 경계선이 (결정 함수가) 완전히 일치하는 상황을 뜻한다.

728x90

6.3 두 개의 UCI 데이터 세트를 선택하여 선형 커널과 가우스 커널을 사용하여 SVM을 훈련하고 BP 신경망, C4.5 의사결정 트리와 비교하라.

 

BP 결과는 연습문제 5.6 참조

C4.5 결과는 연습문제 4.6 참조

 

import pandas as pd
from sklearn import svm
from sklearn import metrics

names = ['sepal length', 'sepal width', 'petal length', 'petal width', 'class']
def loadData(filename):
	dataSet = pd.read_csv(filename, names=names)
	return dataSet

# 데이터세트 분리
def processData(dataSet, n=10):

	values = ['Iris-setosa', 'Iris-versicolor', 'Iris-virginica']
	classifications = []
	gaps = []
	for value in values:
		temp = dataSet.loc[dataSet['class']==value]
		classifications.append(temp)

		gap = temp.shape[0]//n
		gaps.append(gap)

	D = [None for _ in range(n)]
	for a in range(n):
		for gap, classification in zip(gaps, classifications):
			begin = a * gap
			#print(classification[begin:begin+gap])
			if type(D[a]).__name__ == 'NoneType':
				D[a] = classification[begin:begin+gap]
			else:
				D[a] = D[a].append(classification[begin:begin+gap])
			#print(type(D[a]))
			#print(classification[begin:begin+gap])
	return D

def run(data_train, data_test, kernel='rbf'):
	train_data, train_target = data_train[names[:-1]], data_train[names[-1]]
	test_data, test_target = data_test[names[:-1]], data_test[names[-1]]
	
	# SVC() 조정
	'''
	kernel: 디폴트는 ‘rbf’
		선택 가능한 커널 함수:
		‘linear’:선형 커널
		‘poly’:다항식 커널
		‘rbf’:가우스 커널
		‘sigmod’:sigmod커널 함수
		‘precomputed’:미리 계산된 값 사용
	'''
	clf = svm.SVC(kernel=kernel)

	# fit()훈련
	clf = clf.fit(train_data, train_target)

	predict_target = clf.predict(test_data)

	# Accuracy
	acc = metrics.accuracy_score(test_target, predict_target)
	print('Accuracy:', acc)

if __name__ == '__main__':
	filename = '../UCI/iris/iris.data'
	dataSet = loadData(filename)
	D = processData(dataSet, 3)
	data_train, data_test = D[0].append(D[1]), D[2]

	kinds = ['linear', 'rbf']
	for kind in kinds:
		print(kind, end=' ')
		run(data_train, data_test, kind)
728x90

6.2 LIBSVM을 사용하고, 수박 데이터 세트 3.0𝛼상에서 선형 커널과 가우스 커널을 사용하여 SVM을 훈련하라. 그리고 각 서포트 벡터의 차이에 대해 비교하라.

 

*굳이 LIBSVM을 사용하지 않고, sklearn의 svm을 사용해도 무방합니다!

 

코드는 기본 svm에서 하이퍼파라미터 설정만 바꿔주면 되기 때문에 생략합니다.

 

일단 다른 하이퍼 파라미터를 사용하면 서포트 벡터가 바뀌게 됩니다. 

수박 데이터세트 3.0a는 선형으로 분리하기 어렵기 때문에 선형 커널을 사용했을 시,

c를 아무리 높여도 오분류 상황이 나옵니다. 

그러나 가우스커널을 사용해 c를 높이면 훈련 데이터에 완전히 핏팅할 수 있습니다. 

c가 비교적 작다면 두 서포트벡터는 비슷하고, c계수가 비교적 크다면(c계수가 클수록 정규화 정도는 낮음)

가우스 커널 서포트벡트의 수는 줄어들지만 선형 커널은 변화가 없을것 입니다.

 

C=100일 경우,

 

가우스 커널 서포트 벡터 :  [ 8 9 11 12 13 14 16 2 3 4 5 6 7]

선형 커널 서포트 벡터:  [ 8 9 11 12 13 14 16 2 3 4 5 6 7]

C = 10000일 때,

가우스 커널 서포트 벡터: [11 13 14 1 5 6]

선형 커널 서포트 벡터:  [ 9 11 12 13 14 16 2 3 4 5 6 7]

728x90

링크드인에서 찾은 자료인데, 

모든 문제가 와닿지(?)는 않지만...

좋은 문제들도 있어서 공유해요.

 

인터뷰 준비하지 않더라도

심심할때 하나씩 생각해보는 것도 나쁘지 않을 것 같네요.

 

250+ ML DL Inteview Questions.pdf
0.07MB

해답은 갖고있지 않아요~ ㅠ_ㅠ

 

1. How you can define Machine Learning?
2. What do you understand Labelled training dataset?
3. What are 2 most common supervised ML tasks you have performed so far?
4. What kind of Machine learning algorithm would you used to walk robot in various unknown area?
5. What kind of ML algo you can use to segment your user into multiple groups?
6. What type of learning algo realised on similarity measure to make a prediction?
7. What is an online learning system?
8. What is out of core learning?
9. Can you name couple of ml challenges that you have faced?
10. Can you please give 1 example of hyperparameter tuning wrt some classification algorithm?
11. What is out of bag evaluation?
What do you understand by hard & soft voting classifier?
13. Let’s suppose your ML algorithm is taking 5 min time to train, How will you bring down time to 5 second for
training? (Hint: Distributed Computation)
14. Let’s Suppose I have trained 5 diff model with same training dataset & all of them have achieved 95%
precision. Is there any chance that you can combine all these models to get better result? If yes, How? If no,
Why?
15. What do you understand by Gradient decent? How will you explain Gradient decent to a kid?
Can you please explain diff between regression & classification?
Explain a clustering algorithm of your choice.
How you can explain ML, DL, NLP, Computer vision & reinforcement learning with example in your own
terms?
19. How you can explain semi-supervised ML in your own way with example?
20. What is difference between abstraction & generalization in your own word.
21. What are the steps that you have followed in your last project to prepare the dataset?
In your last project what steps were involved in model selection procedure?
23. If I give you 2 columns of any dataset, what will be the steps will be involved to check the relationship
between those 2 columns?
24. Can you please explain 5 diff kind of strategies at least to handle missing values in dataset?
25. What kind of diff. issues you have faced wrt your raw data? At least mention 5 issues.
What is your strategy to handle categorical dataset? Explain with example.
27. How do you define a model in terms of machine learning or in your own word?
28. What do you understand by k fold validation & in what situation you have used k fold cross validation?
What is meaning of bootstrap sampling? explain me in your own word.
What do you understand by underfitting & overfitting of model with example?

What is diff between cross validation and bootstrapping?
What do you understand by silhouette coefficient?
What is the advantage of using ROC Score?
34. Explain me complete approach to evaluate your regression model
Give me example of lazy learner and eagar learner algorithms example.
What do you understand by holdout method?
What is diff between predictive modelling and descriptive modelling.
How you have derived a feature for model building in your last project?
Explain 5 different encoding techniques.
How do you define some features are not important for ML model? What strategy will you follow
What is difference between Euclidian distance and Manhattan distance. Explain in simple words.
What do you understand by feature selection, transformation, engineering and EDA & What are the steps
that you have performed in each of these in detail with example.
What is difference between single values decomposition (SVD) and PCA? (hint: SVD is one of the way to do
PCA)
What kind of feature transformations you have done in your last project?
45. Have you taken any external feature in any of project from any 3rd party data? If yes, explain that scenario.
If your model is overfitted, what you will do next?
Explain me bias variance trade-off.
What steps would you take to improve accuracy of your model? At-least mention 5 approach. And justify
why would you choose those approach
Explain process of feature engineering in context of text categorization.
Explain vectorization and hamming distance.
Can you please explain chain rule and its use?
What is difference between correlation and covariance?
What are the sampling techniques you have used in your project?
Have you ever used Hypothesis testing in your last project, if yes, explain How?
In which case you will use naïve Bayes classifier and decision tree separately?
What is the adv & disadvantage of naïve Bayes classifier, explain
In case of numerical data what is naïve Bayes classification equation you will use?
Give me scenario where I will be able to use a boosting classifier and regressor?
In case of Bayesian classifier what exactly it tries to learn. Define its learning procedure.
Give me a situation where I will be able to use SVM instead of Logistic regression.
What do you understand by rbf kernel in SVM?
Give me 2 scenarios where AI can be used to increase revenue of travel industry.
What do you understand by leaf node in decision tree?
What is information gain & Entropy in decision tree?
Give disadvantages of using Decision tree
List some of the features of random forest.
How can you avoid overfitting in decision tree?
Explain polynomial regression in your own way.
Explain learning mechanism of linear regression.
What is the cost function in logistic regression?
What is the error function in linear regression?
What is the use of implementing OLS technique wrt dataset?
Explain dendrogram in your own way.
How do you measure quality of clusters in DBSCAN?
How do you evaluate DBSCAN algorithm?
What do you understand by market basket analysis?
Explain centroid formation technique in K Means algorithm.
Have you ever used SVM regression in any of your project, If yes, Why?
Explain the concept of GINI Impurity.
Let’s suppose I have given you dataset with 100 column how you will be able to control growth of decision
tree?
If you are using Ada-boost algorithm & if it is giving you underfitted result What is the hyperparameter tuning
you will do?
Explain gradient boosting algorithm.
Can we use PCA to reduce dimensionality of highly non-linear data.
How do you evaluate performance of PCA.
Have you ever used multiple dimensionality techniques in any project? if yes, give reason. If no, where can
we use it?
What do you understand by curse of dimensionality explain with help of example
What is the difference between anomaly detection and novelty detection
Explain gaussian mixture model.
Give me list of 10 activation functions with explanation
Explain neural network in terms of mathematical function
Can you please corelate a biological neuron and artificial neuron?
Give list of cost functions you heard of, with explanation.
Can I solve problem of classification with tabular data in neural network?
What do you understand by backword propagation in neural network?
Why do we need neural network instead of straight forward mathematical equation?
What are the different weight initialization techniques you have used?
Can you visualize a neural network? if yes provide name of software we can use?
How will you explain training of neural network?
Can you please explain difference between sigmoid & tanh function.
100. Explain disadvantage of using RELU function.
101. How do you select no. of layers & no. of neurons in neural network?
102. Have you ever designed any Neural network architecture by yourself?
103. Can you please explain SWISS Function?
104. What is learning rate in laymen way and how do you control learning rate?
105. What is diff between batch, minibatch & stochastic gradient decent.
106. What do you understand by batch size while training Neural N/w with example
107. Explain 5 best optimizer you know with mathematical explanation.
108. Can you build Neural network without using any library? If yes, prove it.
109. What is use of biases in neural network?
110. How do you do hyper-parameter tuning for neural network
111. What kind of regularization you used wrt neural network.
112. What are the libraries you have used for neural network implementation?
113. What do you understand by custom layer and a custom model?
114. How do you implement differentiation using TensorFlow or Pytorch library?
115. What is meaning of epoch in simple terms?
116. What do you understand by a TensorFlow record?

117. Explain the technique for doing data augmentation in deep learning
118. List down diff CNN network you heard of.
119. List down a names of object detection algorithm you know
120. What is difference between object detection and classification?
121. List down major tasks we perform in CNN.
122. List down algorithms for segmentation
123. Which algorithm you can use to track a football in football match.
124. If I give you a satellite image data, so which algo you will use to identify image from those image data
125. Which algorithm you will use for PCB fault detection.
126. What do you understand by pretrained model?
127. Explain different types of transfer learning.
128. Explain me where your CNN network will fail with example. And where we can use RNN network.
129. Which GPU you have been using to train your object detection model?
130. How much data set you have used for this model, what was epoch, time and accuracy of the model
131. What kind of optimization you have done for training object detection model
132. How do you evaluate your object detection model?
133. List down algorithm for object tracking
134. What do you understand by FPS (frame per second)?
135. Can you please explain 2D & 3D convolution?
136. What do you understand by batch normalization?
137. Which algorithm you use for detecting handwriting detection?
138. Explain me SoftMax function.
139. What is disadvantage of using RNN?
140. List down at least 5 RNN?
141. Explain architectural diagram of LSTM, Also list Adv & dis adv
142. Explain architectural diagram of BI LSTM, Also list Adv & dis adv
143. Explain architectural diagram of stacked LSTM. Also list Adv & dis adv
144. What do you understand by TF-IDF
145. How you will be able to create a Word 2 vector of your own
146. List down at least 5 vectorization technique.
147. What is difference between RNN and Encoder-Decoder.
148. What do you understand by attention mechanism and what is use of it
149. Have you read a research paper Attention you all need? If not, then why you are claiming you know NLP
150. What do you understand by multi headed attention? explain

728x90

머신러닝 학습자들에게 너무나 유명한 그 책!

ISLR 이라고 불리며 머신러닝/딥러닝 입문자들에게 강추되던 그 책~

드디어 second edition이 나왔네요.

 

https://www.statlearning.com/

 

An Introduction to Statistical Learning

Winner of the 2014 Eric Ziegel award from Technometrics. As the scale and scope of data collection continue to increase across virtually all fields, statistical learning has become a critical toolkit for anyone who wishes to understand data. An Introductio

www.statlearning.com

 

들어가면 무료로 다운로드 받을 수 있어요.

 

물론 1st 에디션은 이미 번역본이 나온 상태지만...

가볍지만 가볍지 않아 많은 질책을 들었던 그 책

 

번역이 아주 매끄럽지는 않아 영문판을 봤던 기억이...ㅠㅠ

 

 

second edition에는

 

  • Deep learning
  • Survival analysis
  • Multiple testing
  • Naive Bayes and generalized linear models
  • Bayesian additive regression trees
  • Matrix completion

6개 내용이 추가되었다고 합니다. 

 

 

728x90

for dummies 시리즈는 유명해서 아마 본적이 있을 텐데요...

 

IBM에 근무할 때 알던 지인이 전해 준 책입니다. 오픈소스이구요. 

책은 https://www.ibm.com/downloads/cas/GB8ZMQZ3 여기 링크에서 쉽게 다운로드 받을 수 있습니다. 가입 필요없어요!

 

내용은 deep하진 않고...그냥 영어 공부한다고 생각하고 읽어보면 좋을 정도?^^:;

 

 

IBM에서는 머신러닝/딥러닝의 대중화를 위한 수업 기획도 활발히하고 있는 것 같아요. 

 

마지막 7장의 내용이 인상 깊네요. 어려운 이야기는 아니지만 쉽게 잘 요약한 것 같습니다.

 

 

728x90

식과 관련 내용을 복기하면...

 

 

점 x의 초평면 상의 투영 점을 x'라고 가정한다면, wTx+b=0 가 됩니다. 

초평면의 법선벡터는 w이고, 이는 x-x'와 평행입니다. 

그리고,

이기 때문에, 따라서

가 됩니다.

728x90

MNIST 데이터를 사용한 CNN 코드 예제는 Kaggle이나 Github에 넘쳐나죠~

 

참고 할만한 코드:

How to Develop a Convolutional Neural Network From Scratch for MNIST Handwritten Digit Classification

https://machinelearningmastery.com/how-to-develop-a-convolutional-neural-network-from-scratch-for-mnist-handwritten-digit-classification/

 

Kaggle 코드 (중국어 설명^^:;)

https://github.com/han1057578619/kaggle_competition/blob/master/Digit_Recogniz/Tensorflow_CNN_0.99700_top7%25.ipynb

 

GitHub - han1057578619/kaggle_competition: 记录一下在Kaggle上做过的题目

记录一下在Kaggle上做过的题目. Contribute to han1057578619/kaggle_competition development by creating an account on GitHub.

github.com

 

 

앞에 5.8번 문제도 그렇고, 뚜렷한 정답이 있는 문제는 아닙니다.

텐서플로우로 구현하느냐, 파이토치로 하느냐, 아니면 케라스로 하느냐에 따라 난이도 차이는 있겠지요.

기본적인 내용이니 여러가지 툴을 사용해 해보시길 권장합니다.

+ Recent posts