Setup:
In [1]:
using Distributions;
using PyPlot;
include("Diss.jl");
include("vowels2.jl");
Category means for reference (have been mostly not using duration since it causes some problems with scaling):
vowel [duration; F0; F1; F2; F3; F4]
In [2]:
# Again, scaling down the variability of the data here.
var_scaling = 0.7
iy_sample = cat(1,rand(MvNormal(iy_mu,iy_sigma*var_scaling),500),zeros(1,500));
ei_sample = cat(1,rand(MvNormal(ei_mu,ei_sigma*var_scaling),500),ones(1,500));
ae_sample = cat(1,rand(MvNormal(ae_mu,ae_sigma*var_scaling),500),ones(1,500)*2);
oo_sample = cat(1,rand(MvNormal(oo_mu,oo_sigma*var_scaling),500),ones(1,500)*3);
uw_sample = cat(1,rand(MvNormal(uw_mu,uw_sigma*var_scaling),500),ones(1,500)*4);
ah_sample = cat(1,rand(MvNormal(ah_mu,ah_sigma*var_scaling),500),ones(1,500)*5);
aw_sample = cat(1,rand(MvNormal(aw_mu,aw_sigma*var_scaling),500),ones(1,500)*6);
eh_sample = cat(1,rand(MvNormal(eh_mu,eh_sigma*var_scaling),500),ones(1,500)*7);
ih_sample = cat(1,rand(MvNormal(ih_mu,ih_sigma*var_scaling),500),ones(1,500)*8);
oa_sample = cat(1,rand(MvNormal(oa_mu,oa_sigma*var_scaling),500),ones(1,500)*9);
uh_sample = cat(1,rand(MvNormal(uh_mu,uh_sigma*var_scaling),500),ones(1,500)*10);
Trying with gradually increasing vowel inventories.
First test is a five-vowel system with /i/, /u/, /$\epsilon$/, /o/, and /a/:
In [3]:
sample_5 = cat(2,iy_sample,oa_sample,uw_sample,ah_sample,eh_sample);
ord = randperm(size(sample_5,2));
col1 = permute!(sample_5[1,:],ord);
col2 = permute!(sample_5[2,:],ord);
col3 = permute!(sample_5[3,:],ord);
col4 = permute!(sample_5[4,:],ord);
col5 = permute!(sample_5[5,:],ord);
col6 = permute!(sample_5[6,:],ord);
col7 = permute!(sample_5[7,:],ord);
vowels_5_rand = cat(1,col1,col2,col3,col4,col5,col6,col7);
In [4]:
scatter(vowels_5_rand[3,:],vowels_5_rand[4,:],c=vowels_5_rand[7,:])
Out[4]:
As seen in the graph above, this is a pretty easy problem for the most part. uw and oa are the most similar here. They are the two clusters which show some degree of overlap, seen in the lower left.
Learning in 2 dimensions (F1,F2) with deterministic competition:
In [5]:
vowelMix5 = ItterMix(2,10,1,{10},{1},{},eye(2),1);
for i=1:2000
update(vowelMix5,vowels_5_rand[3:4,i],1);
end
j = 1
for i=1:length(vowelMix5.components)
if vowelMix5.phi[i]>0.01
print(j,' ', vowelMix5.components[i].mu)
print('\n')
j+=1
end
end
In [6]:
Mix5_sample = sample(vowelMix5,5000);
scatter(Mix5_sample[1,:],Mix5_sample[2,:],c=Mix5_sample[3,:])
Out[6]:
In [7]:
Mix5_sample = sample(vowelMix5,5000,0.05);
scatter(Mix5_sample[1,:],Mix5_sample[2,:],c=Mix5_sample[3,:])
Out[7]:
In [8]:
contourplot(vowelMix5,[1;2],"none")
Out[8]:
In [9]:
Mix5_sample = sample(vowelMix5,5000,"none");
scatter(Mix5_sample[1,:],Mix5_sample[2,:],c=Mix5_sample[3,:])
Out[9]:
In this run of the model, too many categories were learned, although the number of categories is somewhat variable.
1~iy, 2~uw, 3~oa, 4~eh, 5~ah, 6~oa
Learning in 2 dimensions (F1,F2) with probabilistic competition (tends to over-learn):
In [10]:
vowelMix5 = ItterMix(2,10,1,{10},{1},{},eye(2),1);
for i=1:2000
update(vowelMix5,vowels_5_rand[3:4,i],2);
end
j = 1
for i=1:length(vowelMix5.components)
if vowelMix5.phi[i]>0.05
print(j,' ', vowelMix5.components[i].mu)
print('\n')
j+=1
end
end
In [11]:
Mix5_sample = sample(vowelMix5,5000,"none");
scatter(Mix5_sample[1,:],Mix5_sample[2,:],c=Mix5_sample[3,:])
Out[11]:
In [12]:
contourplot(vowelMix5,[1;2],"none")
Out[12]:
1~ih, 2~oa, 3~eh, 4~ah, 5~uw, 6~eh
Learning in 3 dimensions (dc):
In [13]:
scatter3D(vowels_5_rand[4,:],vowels_5_rand[2,:],vowels_5_rand[3,:],c=vowels_5_rand[7,:])
Out[13]:
In [14]:
vowelMix5 = ItterMix(3,10,1,{10},{1},{},eye(3),1);
for i=1:2000
update(vowelMix5,vowels_5_rand[2:4,i],1);
end
j = 1
for i=1:length(vowelMix5.components)
if vowelMix5.phi[i]>0.05
print(j,' ', vowelMix5.components[i].mu)
print('\n')
j+=1
end
end
In [15]:
contourplot(vowelMix5,[2;3],"none")
Out[15]:
pc:
In [16]:
vowelMix5 = ItterMix(3,10,1,{10},{1},{},eye(3),1);
for i=1:2000
update(vowelMix5,vowels_5_rand[2:4,i],2);
end
j = 1
for i=1:length(vowelMix5.components)
if vowelMix5.phi[i]>0.05
print(j,' ', vowelMix5.components[i].mu)
print('\n')
j+=1
end
end
In [17]:
contourplot(vowelMix5,[2;3],"none")
Out[17]:
4 dimensions (dc):
In [18]:
vowelMix5 = ItterMix(4,10,1,{10},{1},{},eye(4),1);
for i=1:2000
update(vowelMix5,vowels_5_rand[2:5,i],1);
end
j = 1
for i=1:length(vowelMix5.components)
if vowelMix5.phi[i]>0.05
print(j,' ', vowelMix5.components[i].mu)
print('\n')
j+=1
end
end
In [19]:
contourplot(vowelMix5,[2;3],"none")
Out[19]:
pc:
In [20]:
vowelMix5 = ItterMix(4,10,1,{10},{1},{},eye(4),1);
for i=1:2000
update(vowelMix5,vowels_5_rand[2:5,i],2);
end
j = 1
for i=1:length(vowelMix5.components)
if vowelMix5.phi[i]>0.05
print(j,' ', vowelMix5.components[i].mu)
print('\n')
j+=1
end
end
In [21]:
contourplot(vowelMix5,[2;3],"none")
Out[21]:
5 dimensions (dc):
In [22]:
vowelMix5 = ItterMix(5,10,1,{10},{1},{},eye(5),1);
for i=1:2000
update(vowelMix5,vowels_5_rand[2:6,i],1);
end
j = 1
for i=1:length(vowelMix5.components)
if vowelMix5.phi[i]>0.05
print(j,' ', vowelMix5.components[i].mu)
print('\n')
j+=1
end
end
In [23]:
contourplot(vowelMix5,[2;3],"none")
Out[23]:
In [24]:
Mix5_sample = sample(vowelMix5,5000,"none");
scatter(Mix5_sample[2,:],Mix5_sample[3,:],c=Mix5_sample[6,:])
Out[24]:
pc:
In [25]:
vowelMix5 = ItterMix(5,10,1,{10},{1},{},eye(5),1);
for i=1:2000
update(vowelMix5,vowels_5_rand[2:6,i],2);
end
j = 1
for i=1:length(vowelMix5.components)
if vowelMix5.phi[i]>0.05
print(j,' ', vowelMix5.components[i].mu)
print('\n')
j+=1
end
end
In [26]:
Mix5_sample = sample(vowelMix5,5000,"none");
scatter(Mix5_sample[2,:],Mix5_sample[3,:],c=Mix5_sample[6,:])
Out[26]:
In [28]:
contourplot(vowelMix5,[2;3],"none")
Out[28]:
Adding schwa
In [27]:
sample_6 = cat(2,iy_sample,oa_sample,uw_sample,ah_sample,eh_sample,uh_sample);
ord = randperm(size(sample_6,2));
col1 = permute!(sample_6[1,:],ord);
col2 = permute!(sample_6[2,:],ord);
col3 = permute!(sample_6[3,:],ord);
col4 = permute!(sample_6[4,:],ord);
col5 = permute!(sample_6[5,:],ord);
col6 = permute!(sample_6[6,:],ord);
col7 = permute!(sample_6[7,:],ord);
vowels_6_rand = cat(1,col1,col2,col3,col4,col5,col6,col7);
In [29]:
scatter(vowels_6_rand[3,:],vowels_6_rand[4,:],c=vowels_6_rand[7,:])
Out[29]:
2-d dc:
In [31]:
vowelMix6 = ItterMix(2,10,1,{10},{1},{},eye(2),1);
for i=1:2000
update(vowelMix6,vowels_6_rand[3:4,i],1);
end
j = 1
for i=1:length(vowelMix6.components)
if vowelMix6.phi[i]>0.05
print(j,' ', vowelMix6.components[i].mu)
print('\n')
j+=1
end
end
In [32]:
Mix6_sample = sample(vowelMix6,5000,"none");
scatter(Mix6_sample[1,:],Mix6_sample[2,:],c=Mix6_sample[3,:])
Out[32]:
2-d pc:
In [34]:
vowelMix6 = ItterMix(2,10,1,{10},{1},{},eye(2),1);
for i=1:2000
update(vowelMix6,vowels_6_rand[3:4,i],2);
end
j = 1
for i=1:length(vowelMix6.components)
if vowelMix6.phi[i]>0.05
print(j,' ', vowelMix6.components[i].mu)
print('\n')
j+=1
end
end
In [35]:
Mix6_sample = sample(vowelMix6,5000,"none");
scatter(Mix6_sample[1,:],Mix6_sample[2,:],c=Mix6_sample[3,:])
Out[35]:
3-d dc:
In [61]:
vowelMix6 = ItterMix(3,10,1,{10},{1},{},eye(3));
for i=1:2000
update(vowelMix6,vowels_6_rand[2:4,i],1);
end
j = 1
for i=1:length(vowelMix6.components)
if vowelMix6.phi[i]>0.05
print(j,' ', vowelMix6.components[i].mu)
print('\n')
j+=1
end
end
In [ ]:
Mix6_sample = sample(vowelMix6,5000,"none");
scatter(Mix6_sample[1,:],Mix6_sample[2,:],c=Mix6_sample[4,:])
3-d pc:
In [65]:
vowelMix6 = ItterMix(3,10,1,{10},{1},{},eye(3));
for i=1:2000
update(vowelMix6,vowels_6_rand[2:4,i],2);
end
j = 1
for i=1:length(vowelMix6.components)
if vowelMix6.phi[i]>0.05
print(j,' ', vowelMix6.components[i].mu)
print('\n')
j+=1
end
end
In [ ]:
Mix6_sample = sample(vowelMix6,5000,"none");
scatter(Mix6_sample[1,:],Mix6_sample[2,:],c=Mix6_sample[4,:])
4-d dc:
In [68]:
vowelMix6 = ItterMix(4,10,1,{10},{1},{},eye(4));
for i=1:2000
update(vowelMix6,vowels_6_rand[2:5,i],1);
end
j = 1
for i=1:length(vowelMix6.components)
if vowelMix6.phi[i]>0.05
print(j,' ', vowelMix6.components[i].mu)
print('\n')
j+=1
end
end
In [ ]:
Mix6_sample = sample(vowelMix6,5000,"none");
scatter(Mix6_sample[1,:],Mix6_sample[2,:],c=Mix6_sample[5,:])
4-d pc:
In [74]:
vowelMix6 = ItterMix(4,10,1,{10},{1},{},eye(4));
for i=1:2000
update(vowelMix6,vowels_6_rand[2:5,i],2);
end
j = 1
for i=1:length(vowelMix6.components)
if vowelMix6.phi[i]>0.05
print(j,' ', vowelMix6.components[i].mu)
print('\n')
j+=1
end
end
In [ ]:
Mix6_sample = sample(vowelMix6,5000,"none");
scatter(Mix6_sample[1,:],Mix6_sample[2,:],c=Mix6_sample[5,:])
5-d dc:
In [76]:
vowelMix6 = ItterMix(5,10,1,{10},{1},{},eye(5));
for i=1:2000
update(vowelMix6,vowels_6_rand[2:6,i],1);
end
j = 1
for i=1:length(vowelMix6.components)
if vowelMix6.phi[i]>0.05
print(j,' ', vowelMix6.components[i].mu)
print('\n')
j+=1
end
end
5-d pc:
In [78]:
vowelMix6 = ItterMix(5,10,1,{10},{1},{},eye(5));
for i=1:2000
update(vowelMix6,vowels_6_rand[2:6,i],2);
end
j = 1
for i=1:length(vowelMix6.components)
if vowelMix6.phi[i]>0.05
print(j,' ', vowelMix6.components[i].mu)
print('\n')
j+=1
end
end
adding /e/
In [122]:
sample_7 = cat(2,iy_sample,oa_sample,uw_sample,ah_sample,eh_sample,uh_sample,ei_sample);
ord = randperm(size(sample_7,2));
col1 = permute!(sample_7[1,:],ord);
col2 = permute!(sample_7[2,:],ord);
col3 = permute!(sample_7[3,:],ord);
col4 = permute!(sample_7[4,:],ord);
col5 = permute!(sample_7[5,:],ord);
col6 = permute!(sample_7[6,:],ord);
col7 = permute!(sample_7[7,:],ord);
vowels_7_rand = cat(1,col1,col2,col3,col4,col5,col6,col7);
In [127]:
scatter(vowels_7_rand[3,:],vowels_7_rand[4,:],c=vowels_7_rand[7,:])
Out[127]:
2-d dc:
In [100]:
vowelMix7 = ItterMix(2,10,1,{10},{1},{},eye(2));
for i=1:2000
update(vowelMix7,vowels_7_rand[3:4,i],1);
end
j = 1
for i=1:length(vowelMix7.components)
if vowelMix7.phi[i]>0.05
print(j,' ', vowelMix7.components[i].mu)
print('\n')
j+=1
end
end
2-d pc:
In [106]:
vowelMix7 = ItterMix(2,10,1,{10},{1},{},eye(2));
for i=1:2000
update(vowelMix7,vowels_7_rand[3:4,i],2);
end
j = 1
for i=1:length(vowelMix7.components)
if vowelMix7.phi[i]>0.05
print(j,' ', vowelMix7.components[i].mu)
print('\n')
j+=1
end
end
3-d dc:
In [116]:
vowelMix7 = ItterMix(3,10,1,{10},{1},{},eye(3));
for i=1:2000
update(vowelMix7,vowels_7_rand[2:4,i],1);
end
j = 1
for i=1:length(vowelMix7.components)
if vowelMix7.phi[i]>0.05
print(j,' ', vowelMix7.components[i].mu)
print('\n')
j+=1
end
end
3-d pc:
In [139]:
vowelMix7 = ItterMix(3,10,1,{10},{1},{},eye(3));
for i=1:2000
update(vowelMix7,vowels_7_rand[2:4,i],2);
end
j = 1
for i=1:length(vowelMix7.components)
if vowelMix7.phi[i]>0.05
print(j,' ', vowelMix7.components[i].mu)
print('\n')
j+=1
end
end
4-d dc:
In [135]:
vowelMix7 = ItterMix(4,10,1,{10},{1},{},eye(4));
for i=1:2000
update(vowelMix7,vowels_7_rand[2:5,i],1);
end
j = 1
for i=1:length(vowelMix7.components)
if vowelMix7.phi[i]>0.05
print(j,' ', vowelMix7.components[i].mu)
print('\n')
j+=1
end
end
4-d pc:
In [143]:
vowelMix7 = ItterMix(4,10,1,{10},{1},{},eye(4));
for i=1:2000
update(vowelMix7,vowels_7_rand[2:5,i],2);
end
j = 1
for i=1:length(vowelMix7.components)
if vowelMix7.phi[i]>0.05
print(j,' ', vowelMix7.components[i].mu)
print('\n')
j+=1
end
end
In [ ]: