<jupyter_start><jupyter_text>UAS DTS AI 2019Nama : <NAME>Kelas : AI 3 Import Library<jupyter_code>import pandas as pd
import numpy as np 
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
import os
import shutil 
import sys<jupyter_output><empty_output><jupyter_text>Data Preprocessing<jupyter_code>df = pd.read_excel('PH2_dataset_new.xlsx')
df.fillna(0,inplace=True)
df.drop(df.index[0],inplace=True)
df.head()
df.rename(columns={'Asymmetry\n(0/1/2)':'Asymmetry',
                  'Image Name':'img_name', 'Histological Diagnosis':'hist_diag', 
                   'Common Nevus':'common_nevus','Atypical Nevus':'atypical_nevus',
                   'Pigment Network\n(AT/T)':'pigment_network', 'Dots/Globules\n(A/AT/T)':'Dots/Globules', 
                   'Streaks\n(A/P)':'Streaks','Regression Areas\n(A/P)':'Regression_areas', 
                   'Blue-Whitish Veil\n(A/P)':'Blue_Whitish Veil'},inplace=True)
common_nevus=df['img_name'].loc[df['common_nevus'] == 'X'].values
atypical_nevus=df['img_name'].loc[df['atypical_nevus'] == 'X'].values
melanoma=df['img_name'].loc[df['Melanoma'] == 'X'].values

melanoma<jupyter_output><empty_output><jupyter_text>Membuat direktori baru untuk menyimpan datasets baru<jupyter_code>path = 'PH2 Dataset images'
new_dir= '/home/tama/DTS 2019/UAS'
new_dir_com=os.path.join(new_dir,'commonNevus')
new_dir_aty=os.path.join(new_dir,'atypicalNevus')
new_dir_mela=os.path.join(new_dir,'melanoma')
os.mkdir(new_dir_com)
os.mkdir(new_dir_aty)
os.mkdir(new_dir_mela)
#!pwd<jupyter_output><empty_output><jupyter_text>Copy file image common nevus dari folder PH2 Dataset images ke folder commonNevus<jupyter_code>for i in common_nevus:
    common_nevus_path=os.path.join(path,i,i+'_Dermoscopic_Image',i+'.bmp')
    
    try:
        shutil.copy(common_nevus_path,new_dir_com)
    except IOError as e:
        print("Unable to copy file. %s" % e)
    except:
        print("Unexpected error:", sys.exc_info())<jupyter_output><empty_output><jupyter_text>Copy file image common nevus dari folder PH2 Dataset images ke folder atypicalNevus<jupyter_code>for i in atypical_nevus:
    atypical_nevus_path=os.path.join(path,i,i+'_Dermoscopic_Image',i+'.bmp')
    
    try:
        shutil.copy(atypical_nevus_path,new_dir_aty)
    except IOError as e:
        print("Unable to copy file. %s" % e)
    except:
        print("Unexpected error:", sys.exc_info())<jupyter_output><empty_output><jupyter_text>Copy file image common nevus dari folder PH2 Dataset images ke folder melanoma<jupyter_code>for i in melanoma:
    melanoma_path=os.path.join(path,i,i+'_Dermoscopic_Image',i+'.bmp')
    
    try:
        shutil.copy(melanoma_path,new_dir_mela)
    except IOError as e:
        print("Unable to copy file. %s" % e)
    except:
        print("Unexpected error:", sys.exc_info())<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13594954449894883, 'fraction_numerical': 0.006657323055360897, 'mean_word_length': 4.923236514522822, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '421561', 'license': 'MIT', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1102, 'n_words': 175, 'path': 'Data_Preprocessing.ipynb', 'repo_name': 'shuistama/skin-cancer-classification', 'size': '2861'}