QuestionQuestion

Please see Question.pdf

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

# -*- coding: utf-8 -*-


import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import adjusted_rand_score
from sklearn.model_selection import GridSearchCV
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.cluster import SpectralClustering, AgglomerativeClustering

def predictWithK(testFeatures, numVessels, trainFeatures=None,
                trainLabels=None):
    # Unsupervised prediction, so training data is unused
   
    scaler = StandardScaler()
    testFeatures = scaler.fit_transform(testFeatures)
    #km = KMeans(n_clusters=numVessels, random_state=100)
    #clf = AgglomerativeClustering(n_clusters=numVessels, linkage='average')
    clf = SpectralClustering(n_clusters=numVessels,
                            random_state=42,
                            n_neighbors=20,
                            affinity='nearest_neighbors',
                            eigen_solver='arpack',
                            assign_labels='kmeans')
    predVessels = clf.fit_predict(testFeatures)
   
    return predVessels

def predictWithoutK(testFeatures, trainFeatures=None, trainLabels=None):
    # Unsupervised prediction, so training data is unused
   
    # Arbitrarily assume 20 vessels
    return predictWithK(testFeatures, 5, trainFeatures, trainLabels...
$70.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Machine Learning Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats