Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions docs/ipynb2markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@

import glob
import os
import shutil
import subprocess

import markdown
from markdown.extensions import Extension
from markdown.treeprocessors import Treeprocessor
from nbconvert.exporters import MarkdownExporter


class ImgExtractor(Treeprocessor):
Expand Down
6 changes: 3 additions & 3 deletions docs/make_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,13 @@ def summarize_methdods_and_functions(
"-o1",
"--output_module_api",
default="../docs/sources/api_modules",
help=("Target directory for the module-level" " API Markdown files"),
help=("Target directory for the module-level API Markdown files"),
)
parser.add_argument(
"-o2",
"--output_subpackage_api",
default="../docs/sources/api_subpackages",
help=("Target directory for the" " subpackage-level API Markdown files"),
help=("Target directory for the subpackage-level API Markdown files"),
)
parser.add_argument(
"-c", "--clean", action="store_true", help="Remove previous API files"
Expand Down Expand Up @@ -459,5 +459,5 @@ def summarize_methdods_and_functions(
out_dir=args.output_subpackage_api,
printlog=not (args.silent),
clean=args.clean,
str_above_header=("mlxtend" " version: %s \n" % (package.__version__)),
str_above_header=("mlxtend version: %s \n" % (package.__version__)),
)
103 changes: 53 additions & 50 deletions docs/sources/user_guide/classifier/Adaline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,19 @@
"# Loading Data\n",
"\n",
"X, y = iris_data()\n",
"X = X[:, [0, 3]] # sepal length and petal width\n",
"X = X[0:100] # class 0 and class 1\n",
"y = y[0:100] # class 0 and class 1\n",
"X = X[:, [0, 3]] # sepal length and petal width\n",
"X = X[0:100] # class 0 and class 1\n",
"y = y[0:100] # class 0 and class 1\n",
"\n",
"# standardize\n",
"X[:,0] = (X[:,0] - X[:,0].mean()) / X[:,0].std()\n",
"X[:,1] = (X[:,1] - X[:,1].mean()) / X[:,1].std()\n",
"X[:, 0] = (X[:, 0] - X[:, 0].mean()) / X[:, 0].std()\n",
"X[:, 1] = (X[:, 1] - X[:, 1].mean()) / X[:, 1].std()\n",
"\n",
"\n",
"ada = Adaline(epochs=30, \n",
" eta=0.01, \n",
" minibatches=None, \n",
" random_seed=1)\n",
"ada = Adaline(epochs=30, eta=0.01, minibatches=None, random_seed=1)\n",
"ada.fit(X, y)\n",
"plot_decision_regions(X, y, clf=ada)\n",
"plt.title('Adaline - Closed Form')\n",
"plt.title(\"Adaline - Closed Form\")\n",
"\n",
"plt.show()"
]
Expand Down Expand Up @@ -261,29 +258,31 @@
"# Loading Data\n",
"\n",
"X, y = iris_data()\n",
"X = X[:, [0, 3]] # sepal length and petal width\n",
"X = X[0:100] # class 0 and class 1\n",
"y = y[0:100] # class 0 and class 1\n",
"X = X[:, [0, 3]] # sepal length and petal width\n",
"X = X[0:100] # class 0 and class 1\n",
"y = y[0:100] # class 0 and class 1\n",
"\n",
"# standardize\n",
"X[:,0] = (X[:,0] - X[:,0].mean()) / X[:,0].std()\n",
"X[:,1] = (X[:,1] - X[:,1].mean()) / X[:,1].std()\n",
"X[:, 0] = (X[:, 0] - X[:, 0].mean()) / X[:, 0].std()\n",
"X[:, 1] = (X[:, 1] - X[:, 1].mean()) / X[:, 1].std()\n",
"\n",
"\n",
"ada = Adaline(epochs=30, \n",
" eta=0.01, \n",
" minibatches=1, # for Gradient Descent Learning\n",
" random_seed=1,\n",
" print_progress=3)\n",
"ada = Adaline(\n",
" epochs=30,\n",
" eta=0.01,\n",
" minibatches=1, # for Gradient Descent Learning\n",
" random_seed=1,\n",
" print_progress=3,\n",
")\n",
"\n",
"ada.fit(X, y)\n",
"plot_decision_regions(X, y, clf=ada)\n",
"plt.title('Adaline - Gradient Descent')\n",
"plt.title(\"Adaline - Gradient Descent\")\n",
"plt.show()\n",
"\n",
"plt.plot(range(len(ada.cost_)), ada.cost_)\n",
"plt.xlabel('Iterations')\n",
"plt.ylabel('Cost')"
"plt.xlabel(\"Iterations\")\n",
"plt.ylabel(\"Cost\")"
]
},
{
Expand Down Expand Up @@ -339,29 +338,31 @@
"# Loading Data\n",
"\n",
"X, y = iris_data()\n",
"X = X[:, [0, 3]] # sepal length and petal width\n",
"X = X[0:100] # class 0 and class 1\n",
"y = y[0:100] # class 0 and class 1\n",
"X = X[:, [0, 3]] # sepal length and petal width\n",
"X = X[0:100] # class 0 and class 1\n",
"y = y[0:100] # class 0 and class 1\n",
"\n",
"# standardize\n",
"X[:,0] = (X[:,0] - X[:,0].mean()) / X[:,0].std()\n",
"X[:,1] = (X[:,1] - X[:,1].mean()) / X[:,1].std()\n",
"X[:, 0] = (X[:, 0] - X[:, 0].mean()) / X[:, 0].std()\n",
"X[:, 1] = (X[:, 1] - X[:, 1].mean()) / X[:, 1].std()\n",
"\n",
"\n",
"ada = Adaline(epochs=15, \n",
" eta=0.02, \n",
" minibatches=len(y), # for SGD learning \n",
" random_seed=1,\n",
" print_progress=3)\n",
"ada = Adaline(\n",
" epochs=15,\n",
" eta=0.02,\n",
" minibatches=len(y), # for SGD learning\n",
" random_seed=1,\n",
" print_progress=3,\n",
")\n",
"\n",
"ada.fit(X, y)\n",
"plot_decision_regions(X, y, clf=ada)\n",
"plt.title('Adaline - Stochastic Gradient Descent')\n",
"plt.title(\"Adaline - Stochastic Gradient Descent\")\n",
"plt.show()\n",
"\n",
"plt.plot(range(len(ada.cost_)), ada.cost_)\n",
"plt.xlabel('Iterations')\n",
"plt.ylabel('Cost')\n",
"plt.xlabel(\"Iterations\")\n",
"plt.ylabel(\"Cost\")\n",
"plt.show()"
]
},
Expand Down Expand Up @@ -418,29 +419,31 @@
"# Loading Data\n",
"\n",
"X, y = iris_data()\n",
"X = X[:, [0, 3]] # sepal length and petal width\n",
"X = X[0:100] # class 0 and class 1\n",
"y = y[0:100] # class 0 and class 1\n",
"X = X[:, [0, 3]] # sepal length and petal width\n",
"X = X[0:100] # class 0 and class 1\n",
"y = y[0:100] # class 0 and class 1\n",
"\n",
"# standardize\n",
"X[:,0] = (X[:,0] - X[:,0].mean()) / X[:,0].std()\n",
"X[:,1] = (X[:,1] - X[:,1].mean()) / X[:,1].std()\n",
"X[:, 0] = (X[:, 0] - X[:, 0].mean()) / X[:, 0].std()\n",
"X[:, 1] = (X[:, 1] - X[:, 1].mean()) / X[:, 1].std()\n",
"\n",
"\n",
"ada = Adaline(epochs=15, \n",
" eta=0.02, \n",
" minibatches=5, # for SGD learning w. minibatch size 20\n",
" random_seed=1,\n",
" print_progress=3)\n",
"ada = Adaline(\n",
" epochs=15,\n",
" eta=0.02,\n",
" minibatches=5, # for SGD learning w. minibatch size 20\n",
" random_seed=1,\n",
" print_progress=3,\n",
")\n",
"\n",
"ada.fit(X, y)\n",
"plot_decision_regions(X, y, clf=ada)\n",
"plt.title('Adaline - Stochastic Gradient Descent w. Minibatches')\n",
"plt.title(\"Adaline - Stochastic Gradient Descent w. Minibatches\")\n",
"plt.show()\n",
"\n",
"plt.plot(range(len(ada.cost_)), ada.cost_)\n",
"plt.xlabel('Iterations')\n",
"plt.ylabel('Cost')\n",
"plt.xlabel(\"Iterations\")\n",
"plt.ylabel(\"Cost\")\n",
"plt.show()"
]
},
Expand Down Expand Up @@ -641,7 +644,7 @@
}
],
"source": [
"with open('../../api_modules/mlxtend.classifier/Adaline.md', 'r') as f:\n",
"with open(\"../../api_modules/mlxtend.classifier/Adaline.md\", \"r\") as f:\n",
" print(f.read())"
]
}
Expand Down
Loading
Loading