Skip to content

Commit e14c246

Browse files
authored
ItPropFit.jl v0.2.0: Multidimensional array margins (#7)
Big overhaul of the API, but maintaining some of the ease-of-use / qol interface of v0.1.0. Changelog: * Add vararg constructor for ArrayFactors * add convenient method for ipf without seed matrix as per Agresti, sec. 9.7.2 * Start multidimensional * progress on multidimensional margins * Create arraydims and arraymargins structs * update for arraymargins & rename arraydims - ArrayDims are now DimIndex (should maybe be DimIndices?) * arrayfactors for multidim margins * Add multidim sorting to ArrayFactors * Refactor DimIndex -> DimIndices * make arraymargins sorted constructor * Update DimIndices - add uniqueness check - add docs - update issorted method * Clean up array margins - Fix reference to DimIndices in docs - Add size method - Remove buggy sorting stuff * update ArrayFactors - Find failure - remove weird sorting code * Fix ArrayFactors Array method - Now works with arbitrary DimIndices - Fixed the size method - Also fixed the size method for ArrayMargins * small doc fix arrayfactors * Make DimIndices consistent nested int vector * Update tests - add DimIndices tests - add ArrayMargins tests - overhaul ArrayFactors tests * add todo in arrayfactors * ipf_mult deals with ArrayMargins and DimIndices - also add getindex method for dimindices * Small fix for multidimensional arraymargins * start update for multidimensional ipf * first working version of multidimensional ipf - also update to julia 1.8.0 * Add dict methods for AF & AM preparation for #6 * Remove DimIndices convenience methods * Merge api for nultidimensional with ipf - remove original ipf - add convenience interface for new ipf - adjust tests - move consistency tests to ArrayMargins * update new interface - Add consistency checks to test - Add margin transform to export - Fix small bug with inconsistent margin info message * Update docs manifest * Update benchmarks.md The new algorithm is quite a bit faster! * Update documentation, bump version * Add constructor for mixed-eltype ArrayFactors * change devbranch in documentation to "dev" * Clean up constructors for types - Move getdims to default_dimindices in DimIndices file - Adjust tests for new constructor setup * Small fixes for constructors in AF & AM docs * final small doc update * Disable info logging in tests For cleaner test output * Remove logging disable again * Update README.md
1 parent 66ac011 commit e14c246

15 files changed

+648
-162
lines changed

Manifest.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This file is machine-generated - editing it directly is not advised
22

3-
julia_version = "1.7.2"
3+
julia_version = "1.8.0"
44
manifest_format = "2.0"
5+
project_hash = "f6dd4230b36847a6d40a3eea7d2682365388770e"
56

67
[deps]

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name = "ItPropFit"
22
uuid = "7a994e6b-35c0-41b3-a964-b7f62fc12992"
33
authors = ["Erik-Jan van Kesteren <[email protected]>"]
4-
version = "0.1.0"
4+
version = "0.2.0"
55

66
[deps]
77

88
[compat]
9-
julia = "1.7"
9+
julia = "1.8"
1010

1111
[extras]
1212
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Multidimensional iterative proportional fitting in Julia.
1010
See the full documentation and getting started [here](https://vankesteren.github.io/ItPropFit.jl/).
1111

1212
```julia
13+
using ItPropFit
14+
1315
# matrix to be adjusted
1416
X = [40 30 20 10; 35 50 100 75; 30 80 70 120; 20 30 40 50]
1517

@@ -21,9 +23,10 @@ v = [200, 300, 400, 100]
2123
fac = ipf(X, [u, v])
2224
```
2325
```
24-
Factors for array of size (4, 4):
25-
1: [0.9986403503185242, 0.8833622306385376, 1.1698911437112522, 0.8895042701910321]
26-
2: [1.616160156063788, 1.5431801747375655, 1.771623700829941, 0.38299396265192226]
26+
[ Info: Converged in 8 iterations.
27+
Factors for 2D array:
28+
[1]: [0.9986403503185242, 0.8833622306385376, 1.1698911437112522, 0.8895042701910321]
29+
[2]: [1.616160156063788, 1.5431801747375655, 1.771623700829941, 0.38299396265192226]
2730
```
2831
```julia
2932
# compute adjusted matrix
@@ -38,10 +41,10 @@ Z = Array(fac) .* X
3841
```
3942
```julia
4043
# check that the margins are indeed [u, v]
41-
margins(Z)
44+
ArrayMargins(Z)
4245
```
4346
```
44-
2-element Vector{Vector{Float64}}:
45-
[150.0000000009452, 299.99999999962523, 399.99999999949796, 149.99999999993148]
46-
[200.0, 299.99999999999994, 399.99999999999994, 99.99999999999997]
47+
Margins of 2D array:
48+
[1]: [150.0000000009452, 299.99999999962523, 399.99999999949796, 149.99999999993148]
49+
[2]: [200.0, 299.99999999999994, 399.99999999999994, 99.99999999999997]
4750
```

0 commit comments

Comments
 (0)