Ay: Aralık 2019

Elam Ending Nedir?

Basketbolda maç sonu faul düellosunu önlemek için oluşturulmuş bir sistemdir. Maçın bitimine 4 dakika kaldığında süre durdurulur ve hedef skor seçilir (Öndeki takımın 7 sayı fazlası olarak.). Ardından istenen skora ulaşılınca maç noktalanır. Yine de maç sonunda 3 ile kazanacabilecekken taktik fauller yine de yapılabilir veya yenik takımın hücumu ile kendini yormak istemeyen galip takım yapar faülü ve hücumuna bakar. Seyircilerin maç izleme alışkanlıklar değişmesi de hiç istenen bir şey değildir, İzlenme oranları üzerinde ciddi etkileri olabilir.

When we use Machine Learning Techniques (Instead of Traditional Programming)

Machine Learning is widely used in Industry and Academia but in some cases, Machine Learning is just a waste of time. In some cases, Traditional Rule-Based Model is more accurate than our ML model. Also, some ML models want too much time to prepare. However in other cases, ML surpasses Traditional models by far and also needs so little time to understand complex data. Machine Learning is a very useful tool and like all the tools used in only some cases not all cases. Which Cases We should use Machine Learning:

1-) If the Data Format is too complex. We can’t extract Features easily with Traditional Programming Techniques. For Example, Image Segmentation Tasks are so hard to do with Traditional programming and also İmage Processing.

2-) If your data is dynamic. This type of problem can’t automate with Traditional Programming Pipeline (Programmer have to write code and test for all the data before used in production). This type of Problem is very good for Machine Learning. Some Machine Learning Algorithms embrace new Training with new data. Others need new Training but either of them can’t need explicit programming. An example of this type of problem is Spam Email problem.

3-) If the data is too large. Human can’t easily understand 14-dimensional data or 10000 examples of behavior. It is hard for us but not that important for Machine Learing models. Machine Learning models is easily evaluate all dimensions and easily use in all the data. An Example of this type of problem is nearly all the Machine Learning tasks. Uci Heart Data is good data for understand this effect.

4-) If we don’t have solution for this problem for Traditional Programming. We should use Machine Learning. We don’t have any chance. GANs for Example is like this type of problem.

Conclusion

Machine Learning is only a tool. We only use Machine Learning in certain type of tasks. Think carefully 🙂 .

100 Page Machine Learning Book Nasıl bir Kitap

Kitap öncelikle önce okuyun sonra alın özgüveniyle kendini öne çıkarıyor . Benim de ilgimi çekti özgüveniyle ve elbette okumaya başladım.

Kitap öncelikle öğrenme çeşitlerinden bahsediyor ve notasyonuna alışmaya başlamamızı sağlıyor. Notasyon olarak bir Kantardzic olamıyor ve kitapta yer yer şu formülü 1 internette aratma yoluna düşürüyor insanı. Parantezlerin nerede bitip nerede başladığını seçmek biraz yorucu olabiliyor.

Lineer Regresyon ile başlayan algoritma anlatımı gerçekten mantıklı bir yaklaşım olarak göze çarpıyor. Lineer Modelleri kolay kolay overfit edemezsiniz kalıbıyla OverFit çok güzel anlatıyor ve insanlara basit model olduğu için yeterince özelleşemiyor algısını yerleştiriyor. Çok başarılı bir anlatım tarzı ve gerçekten beğendim.

Bazı konuların yerleri ne alaka yahu dedirtiyor. Örnek vermek gerekirse UnSupervised Learning algoritmaları kitabın sonunda (Gerçek manada) sonunda işleniyor. Öğrenmenin bazı yöntemleri Notasyondan sonra açıklanıyor. Kitaptaki şurada bir boşluk var oraya sığdıralım gitsin felsefesi bazen göze çarpıyor ancak 100 sayfa hedefi doğrultusunda hor göremeyeceğim de açık.

Grafikler formüllerin aksine oldukça açıklayıcı ve bazı yerlerde yazılan yazıdan çok daha etkili olabiliyor. Basit tutulması gerçekten güzel. SVM’in kernel trickini herkes gibi çok iyi anlatması mesela bu konuda örnek olarak verilebilir.

Veri hazırlanma, ön işleme adımlarını anlatması gerçekten takdire şayan ve bazı önemli ek bilgiler vermesi de oldukça güzel. İnsan ister istemez sıkılıyor ancak okunmalı.

Neural Network bölümü işini yapan bir bölüm. Temellerini anlatıyor.

7. Bölüm güzel bilgiler içeriyor. 8. Bölüm ise kitabın belkide en iyi kısmı. Direkt olarak bazı problemlere nasıl yaklaşılabileceği anlatıyor.

Kitap genel olarak böyle. Okunması gerçekten faydalı olabilir ama 0 seviyesinden okumaya başlayacaklar için kitabı okumanın çok çok uzun süreceği de bir gerçek. 0 seviyesindeyseniz okumanızı önermiyorum kısaca. Kitabın web sayfası:

http://themlbook.com/

Google Vision Api Java Helper Class

import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.vision.v1.*;
import com.google.protobuf.ByteString;
import com.google.type.LatLng;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
class VisionSingleton {
private static ImageAnnotatorClient client;
public static ImageAnnotatorClient getImageAnnotatorClient() {
if (client == null) {
GoogleCredentials credentials;
File credentialsPath = new File("cred.json");
try {
credentials = GoogleCredentials.fromStream(new FileInputStream(credentialsPath));
} catch (IOException e) {
return null;
}
ImageAnnotatorSettings settings = null;
try {
settings = ImageAnnotatorSettings.newBuilder().setCredentialsProvider(
FixedCredentialsProvider.create(credentials)
).build();
} catch (IOException e) {
return null;
}
try {
client = ImageAnnotatorClient.create(settings);
} catch (IOException e) {
return null;
}
}
return client;
}
}
public class GVision {
ImageAnnotatorClient Client;
GVision() throws IOException {
Client = VisionSingleton.getImageAnnotatorClient();
}
private Image getImagefromPath(String filepath) throws IOException {
Path path = Paths.get(filepath);
byte[] data = Files.readAllBytes(path);
ByteString imgBytes = ByteString.copyFrom(data);
Image img = Image.newBuilder().setContent(imgBytes).build();
return img;
}
public void getWebDetectionThings(String filepath) throws IOException {
Image img = getImagefromPath(filepath);
List<AnnotateImageRequest> requests = new ArrayList<>();
Feature feat = Feature.newBuilder()
.setType(Feature.Type.WEB_DETECTION)
.build();
AnnotateImageRequest request = AnnotateImageRequest.newBuilder()
.addFeatures(feat)
.setImage(img)
.build();
requests.add(request);
BatchAnnotateImagesResponse resp = Client.batchAnnotateImages(requests);
List<AnnotateImageResponse> responseList = resp.getResponsesList();
for (AnnotateImageResponse imageResponse : responseList) {
WebDetection detection = imageResponse.getWebDetection();
List<WebDetection.WebLabel> labels = detection.getBestGuessLabelsList();
for (WebDetection.WebLabel label : labels) {
System.out.println(label.getLabel());
}
}
}
public void getLandmarkDetection(String filepath) throws IOException {
//Bizim Memleketi Landmarktan Saymamak ne demektir yahu.
Image img = getImagefromPath(filepath);
List<AnnotateImageRequest> requests = new ArrayList<>();
Feature feat = Feature.newBuilder()
.setType(Feature.Type.LANDMARK_DETECTION)
.build();
AnnotateImageRequest request = AnnotateImageRequest.newBuilder()
.addFeatures(feat)
.setImage(img)
.build();
requests.add(request);
BatchAnnotateImagesResponse resp = Client.batchAnnotateImages(requests);
List<AnnotateImageResponse> responseList = resp.getResponsesList();
for (AnnotateImageResponse annotateImageResponse : responseList) {
List<EntityAnnotation> entities = annotateImageResponse.getLandmarkAnnotationsList();
for (EntityAnnotation annotation : entities) {
LocationInfo info = annotation.getLocationsList().listIterator().next();
String desc = annotation.getDescription();
LatLng lang = info.getLatLng();
System.out.printf("Nerede: %s %s", desc, lang);
}
}
}
public String textDetection(String filepath) throws IOException {
Image img = getImagefromPath(filepath);
List<AnnotateImageRequest> requests = new ArrayList<>();
Feature feat = Feature.newBuilder()
.setType(Feature.Type.TEXT_DETECTION)
.build();
AnnotateImageRequest request = AnnotateImageRequest.newBuilder()
.addFeatures(feat)
.setImage(img)
.build();
requests.add(request);
BatchAnnotateImagesResponse resp = Client.batchAnnotateImages(requests);
List<AnnotateImageResponse> responseList = resp.getResponsesList();
final String[] texts=new String[responseList.size()];
int i=0;
for (AnnotateImageResponse annotateImageResponse : responseList) {
texts[i++]= annotateImageResponse.getFullTextAnnotation().getText();
}
String result="";
for(String text:texts){
result+=text;
}
return result;
}
}
view raw GVision.java hosted with ❤ by GitHub