<jupyter_start><jupyter_text><jupyter_code>!pip install deepfeatx
from deepfeatx.image import *
download_dataset('https://udacity-dlnfd.s3-us-west-1.amazonaws.com/datasets/landmark_images.zip', 
                 'landmark_images.zip')
ife = ImageFeatureExtractor()
train=ife.extract_features_from_directory('/content/landmark_images/train', include_classes=True)
test=ife.extract_features_from_directory('/content/landmark_images/test', include_classes=True)
train.head()
from sklearn.linear_model import LogisticRegression
X_train, y_train = train.drop(['filepaths', 'classes'], axis=1), train['classes']
X_test, y_test = test.drop(['filepaths', 'classes'], axis=1), test['classes']
lr = LogisticRegression().fit(X_train, y_train)
lr.score(X_test, y_test)
from sklearn.metrics import roc_auc_score, classification_report, confusion_matrix
roc_auc_score(y_test, lr.predict_proba(X_test), multi_class='ovo')
from sklearn.ensemble import RandomForestClassifier
X_train, y_train = train.drop(['filepaths', 'classes'], axis=1), train['classes']
X_test, y_test = test.drop(['filepaths', 'classes'], axis=1), test['classes']
clf = RandomForestClassifier().fit(X_train, y_train)
clf.score(X_test, y_test)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1426242868785656, 'fraction_numerical': 0.004889975550122249, 'mean_word_length': 8.669291338582678, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '346097', 'license': 'Apache-2.0', 'n_tokens_mistral': 418, 'n_tokens_neox': 415, 'n_words': 66, 'path': 'examples/Landmark_Classification_with_DeepFeatX.ipynb', 'repo_name': 'WittmannF/feature_extraction', 'size': '1227'}