currently i'm doing classification model on FLVQ using IRIS dataset, but i was unable to get proper accuracy and it seems dependant to the initial vector which generated randomly. Mind helping me to crack where's wrong with the code? reference is here.

 def distance(self, clusterSblm) :
    n_kolom = self.n
    n = self.n
    nInput = self.nInput
    jarak = list()
    datatrain = np.array(self.x_train)
    dw = np.array(clusterSblm)
    jarak = list()
    for h in range(k) :
        for i in range(n) :
            data = list()
            for j in range(nInput) :
                sum = (datatrain[j][i] - dw[h][i])**2
    jarak = pd.DataFrame(jarak)
    jarak = jarak.transpose()
    m = len(jarak.columns)
    new_df = jarak.groupby((np.arange(m) // n) + 1, axis=1).sum()
    jarak = new_df.values.tolist()       
    return jarak

def alpha(self, pyb, pmb, mk_iter) :
        n = self.n
        nInput = self.nInput
        learningrate = list()
        mk1 = 1/((mk_iter)-1)
        for i in range(nInput) :
            data = list()
            for j in range(k) :
                pangkat = 0 
                hasil = 0
                sum = 0
                for h in range(k) :
                    if (float(pyb[i][j][h])!=0) :
                        sum = sum + ((self.pembagian(pmb[i][j][h],float(pyb[i][j][h])))**mk1) 
                        sum = sum + 0
                if sum == 0:
                    hasil = 0
                    hasil =  round(pow(float(sum),-mk_iter),6)
        nilai_alpha = pd.DataFrame(learningrate)
        return nilai_alpha

The dw (clusterSblm) is the initial cluster, or the center cluster that is used to measure the distance between data and each cluster point. i feel like there's something wrong with how i count the distance and the alpha values. any help will be much appreciated


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.